如果未添加 WixVariables WixMbaPrereqPackageId
,WixMbaPrereqLicenseUrl
则编译失败。
Windows Installer XML 变量
!(wix.WixMbaPrereqPackageId)
未知。
Windows Installer XML 变量!(wix.WixMbaPrereqLicenseUrl)
未知。
如果添加了这两个变量,即使我的测试计算机安装了 .NET Framework 4.0,引导程序每次都会安装 .NET Framework 4.0。
当目标计算机已经有.NET Framework 时,如何避免安装.NET Framework?
下面是我的示例代码。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="TestBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="e8c02687-b5fe-4842-bcc4-286c2800b556">
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
</BootstrapperApplicationRef>
<!--<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />-->
<Chain>
<PackageGroupRef
Id="Netfx4Full"/>
<MsiPackage Name="SetupProject1.msi" SourceFile="data\SetupProject1.msi" DownloadUrl="http://myserver/SetupProject1.msi" Compressed="no">
</MsiPackage>
<MsiPackage Name="SetupProject2.msi" SourceFile="data\SetupProject2.msi" DownloadUrl="http://myserver/SetupProject2.msi" Compressed="no">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<WixVariable
Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable
Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
</Fragment>
</Wix>