<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.