我在WiX的3.7,我不能让简单的<PackageGroupRef编号=“NetFx40Web” />束元件的作用,因为它不跨网FX安装包带,或在SETUP.EXE把它嵌入。 我使出我创造我自己的软件包这一Bundle.wxs
文件,但我仍然有麻烦。 它似乎总是尝试安装.NET 4,即使已经拥有.NET安装机器。
我不太清楚InstallCondition和DetectCondition之间的差异。 我认为InstallCondition用于如果评估结果为真实的安装包,否则将其卸载。 如何与东西通常是永久性= YES,如大多数的先决条件这项工作? DetectCondition几乎是相反的,我认为,它会检查,如果它已经在系统上,如果是这样,不安装它。
下面是我的全Bundle.wxs
文件,该文件是一个Visual Studio的WiX引导程序项目。 我试图查看注册表和范围了.NET 4.0注册表项是存在的。 如果存在的话,我不想安装.NET 4,如果它不存在,然后再进行安装。 但是,这是行不通的,它总是试图安装.NET。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle
Name="MyProgramBootstrapper"
Version="1.0.0.0"
Manufacturer="Microsoft"
UpgradeCode="{2299B51D-9FD8-4278-90C8-2B79DB37F402}">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="Netfx4Full"/>
<MsiPackage
Id="MyProgramInstaller"
SourceFile="$(var.MyProgramInstaller.TargetPath)"
Compressed="no"/>
</Chain>
</Bundle>
<Fragment>
<Property Id="NET40_FULL_INSTALL_32">
<RegistrySearch
Id ="SearchNet40_32bit"
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Name="Version"
Type ="raw"/>
</Property>
<Property
Id="NET40_FULL_INSTALL_64">
<RegistrySearch
Id ="SearchNet40_64bit"
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Name="Version"
Type ="raw"
Win64="yes" />
</Property>
<WixVariable
Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable
Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<PackageGroup
Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40\dotNetFx40_Full_x86_x64.exe"
DetectCondition="NET40_FULL_INSTALL_32 OR NET40_FULL_INSTALL_64"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"/>
</PackageGroup>
</Fragment>
</Wix>
引导程序安装程序日志:
[010C:2FB0][2013-05-10T12:07:07]w120: Detected partially cached package: Netfx4Full, invalid payload: Netfx4Full, reason: 0x80070570
[010C:2FB0][2013-05-10T12:07:07]i052: Condition 'NETFRAMEWORK40' evaluates to false.
[010C:2FB0][2013-05-10T12:07:07]w120: Detected partially cached package: MyInstaller, invalid payload: f4832BA0972BDE9B6FA8A19FBB614A7BA, reason: 0x80070570
[010C:2FB0][2013-05-10T12:07:07]i101: Detected package: Netfx4Full, state: Absent, cached: Partial
更新,与解决方案。 我用内置的维克斯RegistrySearch,以确定它是否安装。 我不得不引用WixUtilExtension.dll我包项目。 下面是更新Bundle.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
>
<Bundle
Name="MyProgramBootstrapper"
Version="1.0.0.0"
Manufacturer="Microsoft"
UpgradeCode="{2299B51D-9FD8-4278-90C8-2B79DB37F402}">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="Netfx4Full"/>
<!-- TODO: Define the list of chained packages. -->
<!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
<MsiPackage
Id="MyProgramInstaller"
SourceFile="$(var.MyProgramInstaller.TargetPath)"
Compressed="no" />
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearchRef Id="NETFRAMEWORK40"/>
<PackageGroup
Id="Netfx4Full">
<ExePackage
Id="Netfx4FullExe"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40\dotNetFx40_Full_x86_x64.exe"
InstallCommand="/q /norestart /ChainingPackage FullX64Bootstrapper"
DetectCondition="NETFRAMEWORK40"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"/>
</PackageGroup>
</Fragment>
</Wix>