My WIX installer should check for a previously installed version of the software. If an older installation is installed, it must be installed in the same way. I am using RegistrySearch to perform this check.
<Property Id="TARGETDIR">
<RegistrySearch Id="InstallLocation" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ANYVERSION]" Name="InstallLocation" Type="directory" Win64="no" />
</Property>
where [ANYVERSION] is defined in
<Upgrade Id="MyGUID">
<UpgradeVersion Property="OLDVERSION" IncludeMinimum="yes" IncludeMaximum="no" Maximum="$(var.VERSION)" Minimum="0.0.0.0" OnlyDetect="no" />
<UpgradeVersion Property="NEWVERSION" IncludeMinimum="no" Minimum="$(var.VERSION)" Maximum="99.99.99.99" IncludeMaximum="no" OnlyDetect="yes" />
<UpgradeVersion Property="EQUALVERSION" IncludeMinimum="yes" Minimum="$(var.VERSION)" Maximum="$(var.VERSION)" IncludeMaximum="yes" OnlyDetect="yes" />
<UpgradeVersion Property="ANYVERSION" IncludeMinimum="yes" Minimum="0.0.0.0" Maximum="99.99.99.99" IncludeMaximum="yes" OnlyDetect="yes" />
</Upgrade>
My check works fine when another version of my software is already installed.
When there was no installation of my software before, the checks also work with one exception: when another application is installed that writes a record (named installLocation ) without a subset (GUID) to HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall, the check returns installLocation of this applications.
What is wrong with my check? Why does RegistrySearch return installLocation records without a subnode?
Is there any way to do this work with registrySearch or do I need to write my own CustomAction?