Search code examples
wix

Using Util:RegistrySearch to search 64-bit registry in WiX setup project


Consider the following code:

<Wix xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product>
  <Property Id="MyProperty">
    <util:RegistrySearch Id="MyRegistrySearch" Root="HKLM"
      Key="SOFTWARE\MyCompany\MyApp" Win64="yes"
      Value="MyRegistryValue" Variable="MyProperty" />
  </Property>

  <Condition Message="Property not found.">
    <![CDATA[MyProperty]]>
  </Condition>
</Product>

The problem I'm having is the util:RegistrySearch doesn't work in the setup project and the default RegistrySearch doesn't work in 64-bits if I don't set the package to 64-bit (which I can't use due other requirements).

Is there a way to have the util:RegistrySearch working to set the Condition?


Solution

  • util:RegistrySearch is only useful in bundle authoring, not MSI package authoring. But "plain" RegistrySearch can search the 64-bit registry even from a 32-bit package; just specify @Win64="yes".