【问题标题】:WIX Bundle bal:condition - util:RegistrySearch variable always trueWIX Bundle bal:condition - util:RegistrySearch 变量始终为真
【发布时间】:2013-06-18 07:53:57
【问题描述】:

如果已经安装了以前版本的应用程序,我希望我的安装失败。

我正在尝试在 RegEdit 文件中搜索 UpgradeCode。升级代码的值名称是“BundleUpgradeCode”。但是,即使 regedit 中没有条目,Bootstrap 的日志也会将条件值返回为 true。我不确定出了什么问题。

    <util:RegistrySearchRef Id="SearchForInstaller" />

    <util:RegistrySearch Id="VSTORuntimeTest" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="VSTORFeature_CLR40" Variable="VSTORFeature"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4R" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="Version" Variable="VSTORVersionV4R"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="Version" Variable="VSTORVersionV4"/>

    <util:RegistrySearch Id="DotNetTest" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Install" Variable="DotNetInstall"/>
    <util:RegistrySearch Id="DotNetVersion" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version" Variable="DotNetVersion"/>

    <Chain>
        <ExePackage Id="dotNetFx40_Client_x86_x64" SourceFile="$(var.PreReqPath)\DotNetFX40Client\dotNetFx40_Client_x86_x64.exe" PerMachine="yes" Cache="no"
                    Compressed="no"
                    DownloadUrl="http://download.microsoft.com/download/7/B/6/7B629E05-399A-4A92-B5BC-484C74B5124B/dotNetFx40_Client_setup.exe"
                    Permanent="yes"
                    InstallCommand="/q /norestart"
                    DetectCondition="NOT DotNetInstall"
                    InstallCondition="NOT DotNetInstall OR NOT (DotNetVersion >=v4.0.30319)" />

        <ExePackage Id="VSTORuntime" SourceFile="$(var.PreReqPath)\VSTOR40\vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
                    DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
                    PerMachine="yes"
                    InstallCommand="/q /norestart"
                    DetectCondition="VSTORFeature"
                    InstallCondition="NOT VSTORFeature OR NOT (VSTORVersionV4R >=v10.0.40303) OR NOT (VSTORVersionV4 >=v10.0.21022)" />

        <MsiPackage SourceFile="$(var.AEMSetup.TargetPath)" Vital="yes" Compressed="no" Id="WordAddIns" DisplayInternalUI="yes"/>
    </Chain>
</Bundle>
<Fragment>
    <util:RegistrySearch Id="SearchForInstaller"  Variable ="BundleUpgradeCode" Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\Windows" Result="exists"  />

    <bal:Condition Message="Another version of this product is already installed. Installation of version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs in Control Panel." >BundleUpgradeCode</bal:Condition>

</Fragment>

[0E98:0390][2013-06-18T13:22:49]i000:设置字符串变量 'WixBundleName' 为'Avanade Estimation Model - v3.4.3' 赋值 [0E98:0390][2013-06-18T13:22:49]i100:检测开始,3 个包 [0E98:0390][2013-06-18T13:22:49]i000:设置字符串变量 'DotNetInstall' 值为 '1' [0E98:0390][2013-06-18T13:22:49]i000: 将字符串变量“DotNetVersion”设置为值“4.5.50709” [0E98:0390][2013-06-18T13:22:49]i000:设置数值变量 'BundleUpgradeCode' 值为 1 [0E98:0390][2013-06-18T13:22:49]i000: 将字符串变量“VSTORFeature”设置为值“1” [0E98:0390][2013-06-18T13:22:49]i000:设置字符串变量 'VSTORVersionV4' 值 '10.0.40303' [0E98:0390][2013-06-18T13:22:49]i000:设置字符串变量 'VSTORVersionV4R' 值 '10.0.40303' [0E98:0390][2013-06-18T13:22:49]i102:检测到相关捆绑包: {4edb6855-8f5b-438b-9a6b-4598e7083cd7},类型:升级,范围: PerMachine,版本:3.4.2.0,操作:MajorUpgrade [0E98:0390][2013-06-18T13:22:49]i052:条件“不是 DotNetInstall” 评估为假。 [0E98:0390][2013-06-18T13:22:49]i052:条件 'VSTORFeature' 评估为真。 [0E98:0390][2013-06-18T13:22:49]i101:检测到的包: dotNetFx40_Client_x86_x64,状态:不存在,缓存:无 [0E98:0390][2013-06-18T13:22:49]i101:检测到的包:VSTORuntime, 状态:存在,缓存:无 [0E98:0390][2013-06-18T13:22:49]i101: 检测到的包:WordAddIns,状态:存在,缓存:完成 [0E98:0390][2013-06-18T13:22:49]i052:条件“BundleUpgradeCode” 评估为真。 [0E98:0390][2013-06-18T13:22:49]i199:检测 完成,结果:0x0

任何帮助将不胜感激。提前致谢。

【问题讨论】:

    标签: wix wix3.6


    【解决方案1】:
    如果注册表项可用,

    BundleUpgradeCode 变量会从 RegistrySearch 中返回 1。据我了解,如果注册表项可用,我们可以考虑安装以前的版本。在这种情况下,您需要设置

    (BundleUpgradeCode=0) or Not (BundleUpgradeCode=1)

    判断条件为假。这样安装程序将失败并显示 Condition 消息。

    <bal:Condition Message="Another version of this product is already installed. Installation of version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs in Control Panel." >Not (BundleUpgradeCode=1)</bal:Condition>
    

    我怀疑您的注册表搜索条件不正确。为什么使用 Wow6432Node,因为 RegistrySearch 具有属性“Win64”

    【讨论】:

      【解决方案2】:

      尝试搜索 SOFTWARE\Microsoft\Windows 而不是 SOFTWARE\Wow6432Node\Microsoft\Windows。在这种情况下你不需要给 WOW6432Node

      【讨论】:

        猜你喜欢
        • 2013-04-13
        • 2017-03-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多