【问题标题】:util:RegistrySearch "Registry key not found" when using variable inside Win64="$(var.Win64)"util:RegistrySearch "Registry key not found" 在 Win64="$(var.Win64)" 中使用变量时
【发布时间】:2014-03-21 12:42:59
【问题描述】:

当使用yes/no 的变量时,<util:RegistrySearch 找不到注册表项,例如:Win64="$(var.Win64)"

如果我使用字符串 yes/no 而不是变量,它会按预期工作,例如:Win64="yes"

var.Win64 通过构建脚本设置为yes/no,该脚本提示我们为哪个操作系统构建。日志显示它在DetectBegin 之前正确设置为yes

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

编辑:我在 Visual Studio found in this post 中也收到此警告:

警告 1 'Win64' 属性无效 - 值 '$(var.Win64)' 根据其数据类型'http://schemas.microsoft.com/wix/2006/wi:YesNoType' 是无效的 - '$' 字符,十六进制值 0x24,不能包含在名字。

另外,“完全删除 Win64,它会自动解决”在 64 位上不起作用,仍然找不到密钥。

【问题讨论】:

标签: wix


【解决方案1】:

我再次尝试了 here 的建议,只是完全删除了 Win64 属性。

它现在能够找到 64 位的注册表项。我之前一定是搞错了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-22
    • 2017-05-16
    • 1970-01-01
    • 2020-04-26
    • 2015-05-30
    • 1970-01-01
    • 1970-01-01
    • 2013-04-13
    相关资源
    最近更新 更多