Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Installation WiX Bundle bal:condition-util:RegistrySearch变量始终为false_Installation_Wix_Registry_Wix3.6 - Fatal编程技术网

Installation WiX Bundle bal:condition-util:RegistrySearch变量始终为false

Installation WiX Bundle bal:condition-util:RegistrySearch变量始终为false,installation,wix,registry,wix3.6,Installation,Wix,Registry,Wix3.6,如果没有安装第三方软件元素,我希望安装失败。我在捆绑包中添加了一个片段,其中包含util:RegistrySearch和bal:Condition,但我无法让它工作ThirdPartyComLibrary已安装的计算结果永远不会为true。我已确认该键存在,并且我为键使用的值是正确的-我在regedit中复制/粘贴了所选键的名称。日志中没有任何错误 我正在Windows7 64位上用Visual Studio 2012中的WiXTools 3.7构建安装程序,并在WindowsXP SP3和Wi

如果没有安装第三方软件元素,我希望安装失败。我在
捆绑包中添加了一个
片段
,其中包含
util:RegistrySearch
bal:Condition
,但我无法让它工作
ThirdPartyComLibrary已安装
的计算结果永远不会为true。我已确认该键存在,并且我为
键使用的值是正确的-我在regedit中复制/粘贴了所选键的名称。日志中没有任何错误

我正在Windows7 64位上用Visual Studio 2012中的WiXTools 3.7构建安装程序,并在WindowsXP SP3和Windows7 64位上进行测试

在线搜索
util:RegistrySearch
的其他示例时,我遇到了以下条件测试表达式的替代形式

  • ThirdPartyCOMLibraryInstalled=0
    -始终为False
  • ThirdPartyComLibrary已安装1
    -始终为真
  • 以下是
    捆绑包
    代码:

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
         xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
         xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
         xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
    
        <Bundle Name="!(bind.packageName.MyApp)"
                Version="!(bind.packageVersion.MyApp)"
                Manufacturer="!(bind.packageManufacturer.MyApp)"
                UpgradeCode="a07ce1d5-a7ed-4d89-a7ee-fb13a5dd69ba"
                Copyright="Copyright (c) 2013 [Bundle/@Manufacturer]. All rights reserved."
                IconSourceFile="$(var.My_Application1.ProjectDir)MyCo.ico">
    
            <bal:Condition Message="ThirdParty Application COM Library Required. Please (re)install ThirdParty Application and ensure 'Windows API' and '.NET Components' are installed."
            >ThirdPartyCOMLibraryInstalled</bal:Condition>
    
            <Variable Name="InstallFolder"
                      Type="string"
                      Value="[ProgramFilesFolder]MyCo Systems\My_Application\"/>
            <BootstrapperApplicationRef
                Id="WixStandardBootstrapperApplication.HyperlinkLicense" >
    
                <bal:WixStandardBootstrapperApplication
                    ThemeFile="Resources\HyperlinkTheme.xml"
                    LaunchTarget="[InstallFolder]My_Application.exe"
                    LocalizationFile="Resources\HyperlinkTheme.wxl"
                    SuppressRepair="yes"
                    SuppressOptionsUI="yes"
                    LicenseUrl=""
                    LogoFile="Resources/MyCoLogoWt64.png"
    
                />
            </BootstrapperApplicationRef>
            <Chain>
                <PackageGroupRef Id="NetFx40Redist"/>
                <MsiPackage Id ="MyApp"
                            Vital="yes"
                            Name="My Application"
                            SourceFile="$(var.MyApp_Install.TargetDir)MyApp_Install.msi">
                    <MsiProperty Name="INSTALLLOCATION"
                                 Value="[InstallFolder]" />
                </MsiPackage>
            </Chain>
        </Bundle>
    
        <Fragment>
          <util:RegistrySearch
                Variable="ThirdPartyCOMLibraryInstalled"
                Result="exists"
                Root="HKLM"
                Key="SOFTWARE\Classes\ThirdPartyId.Server\CLSID"/>
        </Fragment>
    </Wix>
    
    
    已安装第三方联合图书馆
    
    根本问题在于
    注册表搜索
    位于一个单独的
    片段
    中,该片段从未被引用。因为
    片段
    中没有任何内容被引用,所以链接器会“优化”掉
    片段
    的内容,并且搜索不包括在您的

    旁白:您可能会认为,在
    条件
    中有一个对搜索中提到的变量的引用,链接器应该能够找出搜索是必要的。然而,并非所有情况下都是这样

    幸运的是,解决方案非常简单!您甚至必须从以下两个选项中选择一个:

  • RegistrySearch
    元素移动到
    Bundle
    元素
  • 捆绑包中添加
    RegistrySearchRef
    元素,以引用
    片段中的
    RegistrySearch
    。您还需要提供
    RegistrySearch
    Id
    属性
  • 就个人而言,我喜欢选项二,我甚至可能会将
    条件
    移动到
    片段
    中,并将所有这些内容组合在一起。类似于:

    <Bundle ...>
       <util:RegistrySearchRef Id='SearchForThirdParty' />
    
       ...
    
    </Bundle>
    
    <Fragment>
       <util:RegistrySearch
              Id='SearchForThirdParty' 
              Variable="ThirdPartyCOMLibraryInstalled" 
              Result="exists"
              Root="HKLM"
              Key="SOFTWARE\Classes\ThirdPartyId.Server\CLSID"/>
    
        <bal:Condition Message="ThirdParty Application COM Library Required. Please (re)install ThirdParty Application and ensure 'Windows API' and '.Net Components' are installed.">ThirdPartyCOMLibraryInstalled</bal:Condition>
      </Fragment>
    </Wix>
    
    
    ...
    已安装第三方联合图书馆
    

    应该可以了。

    这正合适。非常感谢。我很高兴将此作为“操作指南”之一发布在WiX文档中,即“基于缺少注册表项的块引导程序安装”我能做些什么来实现这一点?听起来不错。要添加帮助,请针对wix38分支发送一个请求,并更改以下文件:
    src\chm\html
    。代码位于