Pau*_*ice 11 registry installer wix wix3.6
如果未安装第三方软件元素,我希望我的安装失败.我加了Fragment一个util:RegistrySearch和bal:Condition到Bundle,但我不能得到它的工作.ThirdPartyCOMLibraryInstalled永远不会评估为真.我已经确认密钥存在,并且我使用的值Key是正确的 - 我在regedit中复制/粘贴了所选密钥的名称.日志中没有任何错误.
我正在使用Windows 7 64位的Visual Studio 2012中的WiXTools 3.7构建安装程序,并在Windows XP SP3和Windows 7 64位上进行测试.
在线搜索其他示例,util:RegistrySearch我遇到了条件测试表达式的以下替代形式.
ThirdPartyCOMLibraryInstalled = 0 - 总是假的ThirdPartyCOMLibraryInstalled <> 1 - 永远是真的这是Bundle代码:
<?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>
Run Code Online (Sandbox Code Playgroud)
Rob*_*ing 15
根本问题是,它RegistrySearch是一个Fragment永远不会被引用的单独的.因为Fragment引用的内容中没有任何内容,链接器"优化掉"了内容,Fragment并且搜索不包含在您的内容中Bundle.
除此之外:你可以争辩说,在搜索中提到的变量的引用中
Condition,链接器应该能够确定搜索是必要的.但是,这并不适用于所有情况.
幸运的是,解决方案非常简单!你甚至必须从以下两种中选择一种:
RegistrySearch元素移动到Bundle元素.RegistrySearchRef的元素Bundle元素引用RegistrySearch的Fragment.您还需要提供RegistrySearch和Id属性.就个人而言,我喜欢选项二,我甚Condition至可能会把Fragment所有这些东西组合在一起.类似于:
<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>
Run Code Online (Sandbox Code Playgroud)
应该这样做.
| 归档时间: |
|
| 查看次数: |
8770 次 |
| 最近记录: |