I am trying to create a WiX installer for a plugin of one of my applications but have come across something I find strange; perhaps it is the expected behavior but then I would like to know why.
My application saves its installation path in the following registry location:
HKEY_CURRENT_USER\SOFTWARE\MyCompany\MyApp\Installed
As default my application is installed to C:\Program Files\MyApp if x64 and C:\Program Files (x86)\MyApp if x86.
In my plugin installer I have the following in Product.wxs to retrieve the install path of my application:
<Property Id="MY_APP_DIR">
<RegistrySearch Id='my_app_dir' Type='raw' Root='HKCU' Key='SOFTWARE\MyCompany\MyApp' Name='Installed' />
</Property>
I then added the following just to see what is actually retrieved when I run the installer:
<Condition Message="[MY_APP_DIR]">
0
</Condition>
In the case where "C:\Program Files\MyApp\" is stored in the registry I got the following when I run the plugin installer:
Plugin installer (x86): C:\Program Files (x86)\MyApp\
Plugin installer (x64): C:\Program Files\MyApp\
Why is not the value stored in the registry retrieved independently of which platform the msi was built for?
On a x64 machine only the x64 versions of my installers will be used so this should not cause any problems it just confuses me.
EDIT: As requested I have included my entire Product.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestInstaller" Language="1033" Version="1.0.0.0" Manufacturer="MyCompany" UpgradeCode="SOME_GUID">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="MY_APP_DIR">
<RegistrySearch Id="my_app_dir" Root="HKCU" Key="SOFTWARE\MyCompany\MyApp" Name="Installed" Type="raw" />
</Property>
<Condition Message="[MY_APP_DIR]">
0
</Condition>
<Feature Id="ProductFeature" Title="TestInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLFOLDER" Name="TestInstaller">
<Directory Id="MY_APP_DIR" Name="MyAppInstallPath">
<Directory Id="MyAppBinFolder" Name="bin" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents">
<Component Id="ProductComponent" Guid="SOME_GUID" Directory="MyAppBinFolder">
<File Id="Foo.Bar" Source="Foo.Bar" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
MY_APP_DIRis used in your WiX installer? For example is it referenced in aDirectoryelement? - bradfordrg<Directory Id="TARGETDIR" Name="SourceDir">element if I remember correctly. - dbostream