Using WiX, how can I detect if a particular file exists in the SourceDir folder?
I have the following WiX fragment designed to determine whether the Adobe Reader installer has been distributed in the same folder as my MSI file, and if so, run it after installation.
<Property Id="ADOBEREADERINSTALLER">
<DirectorySearch Id="SourceDir" Path="[SourceDir]" Depth="0" AssignToProperty="yes">
<FileSearch
Id="AdbeRdr810_en_US.exe"
Name="AdbeRdr810_en_US.exe"
MaxDate="2011-03-24T13:18:59" MaxSize="23402288" MaxVersion="1.0.0.92"
MinDate="2011-03-24T13:18:00" MinSize="23402288" MinVersion="1.0.0.92"
/>
</DirectorySearch>
</Property>
<Property Id="INSTALLADOBEREADER" Value="1" />
<CustomAction
Id ="InstallAdobeReader"
Property ="ADOBEREADERINSTALLER"
ExeCommand =""
Execute ="immediate"
Return ="asyncNoWait" />
<InstallUISequence>
<ResolveSource After="CostInitialize"> UPGRADINGPRODUCTCODE OR NOT Installed </ResolveSource>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="InstallAdobeReader" After="InstallFinalize"> (UPGRADINGPRODUCTCODE OR NOT Installed) AND ADOBEREADERINSTALLER AND INSTALLADOBEREADER </Custom>
</InstallExecuteSequence>
It appears that the AppSearch
action (which performs the DirectorySearch
and FileSearch
) must occur before the ResolveSource
action (which sets the value of SourceDir
.) This leaves me in backwards-about situation.