In my wix source code, I have to look for 2 entries in the registry to get an install directory :
<Property Id="INSTALLDIR_A">
<RegistrySearch Id='RegA' Type='raw'
Root='HKLM' Key='Software\Path\To\A' Name='InstallLocation' />
<Property Id="INSTALLDIR_B">
<RegistrySearch Id='RegB' Type='raw'
Root='HKLM' Key='Software\Path\To\B' Name='InstallLocation' />
My install directory must be either INSTALLDIR_A or INSTALLDIR_B. If I had to look only to 1 entry, I would have implemented it like that :
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR" Name="My path">
<!-- further code -->
</Directory>
</Directory>
But I want INSTALLDIR to be either INSTALLDIR_A or INSTALLDIR_B depending on which one is defined. How to achieve this ?
There's a custom action SetDirectory (http://wixtoolset.org/documentation/manual/v3/xsd/wix/setdirectory.html) for that. You might try something like using the first value as default and overwriting it if the other one is set:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Software\Path\To\A" />
</Directory>
</Directory>
<SetDirectory Id="INSTALLFOLDER" Value="[INSTALLDIR_B]">INSTALLDIR_B AND NOT INSTALLDIR_A</SetDirectory>
</Fragment>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With