我正在尝试创建一个WiX bundle 软件,该 bundle 软件在MSI安装程序之前安装.NET Framework 4.0。我使用命令行参数\l log.txt
检查了我的 bootstrap 的日志文件,发现ExePackage::DetectCondition
始终评估为false。
我在我的Visual Studio 2010 Windows Installer XML Bootstrapper项目中包括WixNetFxExtension.dll
作为引用。
我包括NetFxExtension
命名空间:
<?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:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
提供基本的 bundle 软件框架:
<Bundle Name="RSA Bootstrapper"
...
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
...
<Chain>
<PackageGroupRef Id="NET40" />
<PackageGroupRef Id="RSA_Application" />
</Chain>
</Bundle>
...
我将
<PropertyRef Id="NETFRAMEWORK40FULL" />
包含在片段中,然后继续为.NET Framework 4.0定义ExePackage(NET40
): <Fragment>
<PropertyRef Id="NETFRAMEWORK40FULL" />
<PackageGroup Id="NET40">
<ExePackage SourceFile="dotNetFx40_Full_x86_x64.exe"
Compressed="yes"
Cache="yes"
DetectCondition="NETFRAMEWORK40FULL"
InstallCommand="/norestart /passive /showrmui /ACTION=Install"
Permanent="yes"
InstallCondition="NOT NETFRAMEWORK40FULL"
Vital="yes" >
<ExitCode Value="0" Behavior="success" />
<ExitCode Value="1641" Behavior="scheduleReboot" />
<ExitCode Value="3010" Behavior="scheduleReboot" />
<ExitCode Behavior="error" /> <!-- Everything else is an error -->
</ExePackage>
...
我还检查了Visual Studio构建输出,以确认是否正确引用了
WixNetFxExtension.dll
:C:\Program Files(x86)\WiX Toolset v3.7\bin\Light.exe ... -ext“C:\Program Files(x86)\WiX Toolset v3.7\bin\WixNetFxExtension.dll”
问题出在
DetectCondition
属性上。无论我将其设置为什么,它的计算结果均为false
。考虑到
NETFRAMEWORK40FULL
引用可能不受信任,我尝试改用以下代码:<Fragment>
<Variable Name="isInstalled"
Type="numeric"
Value="0"
Persisted="yes"
bal:Overridable="yes"/>
<util:RegistrySearch Id="FindInstallKey"
Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install"
Result="exists"
Variable="InstallKeyExists" />
<util:RegistrySearch
Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
Value="Install"
Variable="isInstalled"
After="FindInstallKey"
Condition="InstallKeyExists = true"
Format="raw" />
</Fragment>
设置
DetectCondition="isInstalled"
或DetectCondition="isInstalled = true"
始终为false。甚至设置DetectCondition="true"
总是会得出false!这是我正在谈论的日志片段,带有
DetectCondition="true"
[16A0:17B4][2013-02-13T13:01:43]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe, cmdline: '/l log.txt -burn.unelevated BurnPipe.{33090847-CC78-445B-BAAA-564B840B7E8E} {38F95C6A-EC0F-4402-951B-FABFC5827CB6} 6296'
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\log.txt'
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe'
[16A0:17B4][2013-02-13T13:01:43]i052: Condition '((VersionNT = v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT = v5.2) AND (ServicePackLevel >= 2)) OR ((VersionNT = v6.0) AND (ServicePackLevel >= 1)) OR (VersionNT >= v6.1)' evaluates to true.
[16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleName' to value 'RSA Bootstrapper'
[16A0:17B4][2013-02-13T13:01:43]i100: Detect begin, 2 packages
[16A0:17B4][2013-02-13T13:01:43]i052: Condition 'true' evaluates to false.
[16A0:17B4][2013-02-13T13:01:43]i103: Detected related package: {D431417D-F0AC-4CFB-8E25-E27F5B8101D9}, scope: PerMachine, version: 2.1.15.0, language: 0 operation: MajorUpgrade
[16A0:17B4][2013-02-13T13:01:43]i101: Detected package: dotNetFx40_Full_x86_x64.exe, state: Absent, cached: None
[16A0:17B4][2013-02-13T13:01:43]i101: Detected package: RSA_Preset.msi, state: Absent, cached: None
[16A0:17B4][2013-02-13T13:01:43]i199: Detect complete, result: 0x0
[16A0:17B4][2013-02-13T13:02:04]i200: Plan begin, 2 packages, action: Install
[16A0:17B4][2013-02-13T13:02:04]i052: Condition 'NOT NETFRAMEWORK40FULL' evaluates to true.
具体来说,
i052: Condition 'true' evaluates to false.
即使安装了.NET 4.0完整版,也实际上是Condition 'NOT NETFRAMEWORK40FULL' evaluates to true.
,并且可以在我的注册表中的通常位置和HKLM\SOFTWARE\Wow6432Node
下手动找到.NET 4.0条目(我使用的是64位系统)。我想念什么吗?为什么DetectCondition对我不起作用?该项目可以编译,运行,部署有效载荷,否则可以正常工作。
最佳答案
<PropertyRef Id="NETFRAMEWORK40FULL" />
是对MSI属性的引用,但是您正在创建 bundle 。 bundle 具有与MSI属性不同的变量,尽管Burn本身提供了许多模仿MSI提供的 bundle 变量的 bundle 变量。
也就是说,WixNetFxExtension为4.0 NetFx安装程序提供了软件包组。您可以将所有内容替换为简单的<PackageGroupRef Id="NetFx40Redist" />
。
关于visual-studio-2010 - WiX 'Bundle' 'ExePackage' 'DetectCondition'始终为假,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14863905/