0

<util:RegistrySearch does not find registry keys when using a variable for yes/no for example: Win64="$(var.Win64)".

It works as expected if I use the string yes/no instead of the variable for example: Win64="yes".

The var.Win64 is set to yes/no via a build script which prompts us for which OS to build for. The logs show it is being set to yes properly before DetectBegin.

<!-- Variables.wxi: -->
<?define Win64 = "yes" ?>

<!-- Product.wxs -->
<?xml version="1.0" encoding="UTF-8"?>
<?include ..\Setup\Variables.wxi ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Fragment>

    <Variable Name="MyAppVersion" Type="version" Value="$(var.ProductVersion)" />
    <Variable Name="RegMyAppVersion" Type="version" Value="0.0.0.0" />
    <Variable Name="Win64Version" Type="string" Value="$(var.Win64)" />

    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
                         Result="exists"
                         Value="Version"
                         Variable="RegMyAppExists"
                         Win64="$(var.Win64)"/>

    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
                         Result="value"
                         Value="Version"
                         Variable="RegMyAppVersion"
                         Win64="$(var.Win64)"/>

    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)"
                         Result="value"
                         Value="LicenseKey"
                         Variable="RegMyAppLicenseKey"
                         Win64="$(var.Win64)"/>


[0D30:2BAC][2014-03-21T08:32:03]i001: Burn v3.8.1021.0, Windows v6.1 (Build 7601: Service Pack 1)
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing version variable 'ROIPOSVersion' to value '1.9.26.0'
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing version variable 'RegROIPOSVersion' to value '0.0.0.0'
[0D30:2BAC][2014-03-21T08:32:03]i000: Initializing string variable 'Win64Version' to value 'yes'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Registry key not found. Key = 'SOFTWARE\MyMan\MyProd'
[0D30:2BAC][2014-03-21T08:32:04]i000: Setting numeric variable 'RegMyAppExists' to value 0

EDIT: I also get this warning in Visual Studio found in this post:

Warning 1 The 'Win64' attribute is invalid - The value '$(var.Win64)' is invalid according to its datatype 'http://schemas.microsoft.com/wix/2006/wi:YesNoType' - The '$' character, hexadecimal value 0x24, cannot be included in a name.

Also the "just remove Win64 altogether it will automatically figure it out" doesn't work on 64bit, still doesn't find the key.

Community
  • 1
  • 1
Brock Hensley
  • 3,617
  • 2
  • 29
  • 47
  • 1
    possible duplicate of [How to avoid 'Win64' attribute is invalid when using variables in a WiX installer script?](http://stackoverflow.com/questions/8684692/how-to-avoid-win64-attribute-is-invalid-when-using-variables-in-a-wix-installe) – Brock Hensley Mar 21 '14 at 13:42

1 Answers1

0

I tried the suggestion again from here and just removed the Win64 attribute altogether.

It was able to find the registry key in 64bit now. I must have been mistaken before.

Community
  • 1
  • 1
Brock Hensley
  • 3,617
  • 2
  • 29
  • 47