0
votes
<Property Id="VC2015_X86">
    <RegistrySearch Id="VC2015_X86"
                    Root="HKLM"
                    Key="SOFTWARE\Wow6432Node\Microsoft\DevDiv\vc\Servicing\14.0\RuntimeAdditional"
                    Name="Version"
                    Type="raw" 
                    />
     </Property>

The property is set by this search. But it fails on 32 bit because Wow6432Node search.

But RegistrySearch Element in Wix Doc says Win64 YesNoType Instructs the search to look in the 64-bit registry when the value is 'yes'. When the value is 'no', the search looks in the 32-bit registry. The default value is based on the platform set by the -arch switch to candle.exe or the InstallerPlatform property in a .wixproj MSBuild project: For x86 and ARM, the default value is 'no'. For x64 and IA64, the default value is 'yes'.

If i change this as below will this work on both 32 and 64 bit?

<Property Id="VC2015_X86">
    <RegistrySearch Id="VC2015_X86"
                    Root="HKLM"
                    Key="SOFTWARE\Microsoft\DevDiv\vc\Servicing\14.0\RuntimeAdditional"
                    Name="Version"
                    Type="raw" 
                    />
     </Property> 
1

1 Answers

4
votes

Your changes are halfway there. Despite the implied guidance on Redistributing Visual C++ Files, I recommend that you avoid referring to the Wow6432Node key directly. Instead you should use whatever's available to specify a 32-bit registry view. (To better visualize what the idea of a 32-bit registry view, compare both regular C:\Windows\System32\regedit.exe and C:\Windows\SysWow64\regedit.exe on a 64-bit machine.)

In your case, to look for the presence of the 32-bit redist, this means specifying the Key with it's 32-bit view name (Key="SOFTWARE\Microsoft\DevDiv\vc\Servicing\14.0\RuntimeAdditional"), and explicitly specifying Win64="No" so that the search will use the 32-bit view of the hive in either a 32-bit or 64-bit build of your project.

If you also want to find the 64-bit redist on 64-bit machines, you should add a second search into another property, and, depending on your needs for a 32-bit build, either explicitly specify Win64="Yes" or ensure that the search is only included in a 64-bit build of your project. Odds are that you don't need to search for both, as any given .exe or .dll will depend on only one bitness of the 32-bit or 64-bit redists.