Reputation: 1001
In my Wix Installer, I am searching for registry key for Adobe acrobat reader and displaying a warning dialog with "YES" and "NO" option. This dialog is supposed to display during the install sequence immediately after WelcomeDlg enabling user to "continue" or "exit" the installation if Adobe reader is not installed.
I am finding an issue in my code as the "AdobePrerequisiteDlg" does not honors the "ADOBEREADERINSTALLED" property, The dialog is getting displayed even when registry key exist.
The warning dialog "AdobePrerequisiteDlg" should only be displayed when Property "ADOBEREADERINSTALLED" is not satisfied (i.e. registry key does not exist), But as of now that is not happening as I am able to see the dialog getting displayed everytime.
I tried many changes but not able to figure out where the problem exist. Here is my code :
Product.wxs
<Property Id="ADOBEREADERINSTALLED">
<RegistrySearch Id="ADOBEREADERINSTALLED_REGSEARCH" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" Root="HKLM" Type="raw"/>
</Property>
<UIRef Id="PrerequisiteDialogUI" />
<UI Id="UserInterface">
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="AdobePrerequisiteDlg">1</Publish>
</UI>
Components.wxs
<Fragment>
<UI Id="PrerequisiteDialogUI">
<Dialog Id="AdobePrerequisiteDlg" Width="370" Height="270" Title="Software Requirements Incomplete">
<Control Id="YES" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="YES">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="NO" Type="PushButton" Text="NO" X="236" Y="243" Width="56" Height="17" Cancel="yes" >
<Publish Event="EndDialog" Value="Exit" />
</Control>
<Control Id="Text" Type="Text" X="1" Y="50" Width="340" Height="120" TabSkip="no">
<Text>
The following software requirements have not been met :
Adobe Acrobat Reader
Do you wish to continue ?
</Text>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Prerequisite for $(var.ProductName) is not installed." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Adobe Reader 9.0" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
</Dialog>
</UI>
<InstallUISequence>
<Show Dialog="AdobePrerequisiteDlg" Before="ExecuteAction"> <![CDATA[NOT Installed AND ADOBEREADERINSTALLED]]></Show>
</InstallUISequence>
<Fragment>
Upvotes: 1
Views: 581
Reputation: 195
First of all, you need brackets or double NOT for the condition: NOT (Installed AND ADOBEREADERINSTALLED)
OR NOT Installed AND NOT ADOBEREADERINSTALLED
And then. Do you see WelcomeDialog when you start your installer? Or AdobePrerequisiteDlg goes first? If second variant, you need to make some changes in your code. Try this:
Product.wxs
<Fragment>
<Property Id="ADOBEREADERINSTALLED">
<RegistrySearch Id="ADOBEREADERINSTALLED_REGSEARCH" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" Root="HKLM" Type="raw"/>
</Property>
</Fragment>
<Fragment>
<UIRef Id="UserInterface" />
</Fragment>
<Fragment>
<UI Id="UserInterface">
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<DialogRef Id="AdobePrerequisiteDlg"/>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="AdobePrerequisiteDlg">NOT ADOBEREADERINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="Put_Next_Dialog_Id_Here">ADOBEREADERINSTALLED</Publish>
<Publish Dialog="AdobePrerequisiteDlg" Control="YES" Event="NewDialog" Value="Put_Next_Dialog_Id_Here"/>
<Publish Dialog="AdobePrerequisiteDlg" Control="NO" Event="NewDialog" Value="UserExit"/>
</UI>
</Fragment>
Components.wxs
<Fragment>
<UI Id="PrerequisiteDialogUI">
<Dialog Id="AdobePrerequisiteDlg" Width="370" Height="270" Title="Software Requirements Incomplete">
<Control Id="YES" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="YES"/>
<Control Id="NO" Type="PushButton" Text="NO" X="236" Y="243" Width="56" Height="17" Cancel="yes" />
<Control Id="Text" Type="Text" X="1" Y="50" Width="340" Height="120" TabSkip="no">
<Text>
The following software requirements have not been met :
Adobe Acrobat Reader
Do you wish to continue ?
</Text>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Prerequisite for $(var.ProductName) is not installed." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Adobe Reader 9.0" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
Upvotes: 1