This should be easy, but after several hours I’m coming up blank. ;(
I do a registry search (actually two), because I need to check for either of two previous installs and then install my new files to the location of the prior install that was found.
- Only one of these prior installs will actually exist.
I then need to install my new files to the 'InstallLocation' of which 'PROD#' was found.
<!— Look for the UnInstall key of the 1st possible product -->
<!— GUID = {E928E024-DEFE-41A7-8469-D338212C4943} -->
<Property Id='PROD1'>
<RegistrySearch Id='PROD_REG1'
Type='raw'
Root='HKLM'
Key='$(var.REGKEY_PROD1)'
Name='InstallLocation' />
</Property>
<!— Look for the UnInstall key of the 2nd possible product -->
<!— GUID = {A40A9018-DB9D-4588-A591-F012600C6300} -->
<Property Id='PROD2'>
<RegistrySearch Id='PROD_REG2'
Type='raw'
Root='HKLM'
Key='$(var.REGKEY_PROD2)'
Name='InstallLocation' />
</Property>
<!-- How do I set INSTALL_HERE Property to whichever ‘InstallLocation’ was found? -->
<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALL_HERE">
<Directory Id="MAIN_DIRECTORY" Name="MyProduct"/>
<Directory Id="HELP_DIRECTORY" Name="Help"/>
</Directory>
</Directory>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…