我需要包括微软 。净 4.5作为我的安装包的先决条件,我希望它尽可能自动化。但是,.NET应该 不 在取消行动时被移除。我想我已经阅读了关于如何使用的一切 DetectCondition
和/或 InstallCondition
,但我仍然没有做对;它要么总是运行.NET安装,要么永远不运行它。
这是我最新的设置:
<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'>
<!-- Define minimum .NET Framework version -->
<?define NetFx45MinRelease = 377811?>
...
<Chain>
<PackageGroupRef Id="Netfx45FullPackage"/>
...
</Chain>
<PackageGroup Id="Netfx45FullPackage">
<ExePackage Id="Netfx45Full" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="..\..\..\..\Environment\InstallerResources\Prerequisites\dotnetfx45_full_x86_x64.exe"
InstallCommand="/passive /norestart"
DetectCondition="NETFRAMEWORK45 >= $(var.NetFx45MinRelease)"
InstallCondition="NOT REMOVE AND (NETFRAMEWORK45 < $(var.NetFx45MinRelease))" />
</PackageGroup>
(出于某种原因,我必须定义 NetFx45MinRelease
我自己即使它应该包含在WixNetFxExtension中。)
如何正确设置?