我需要将Microsoft .NET 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>
< p>出于某种原因,尽管应该包含在WixNetFxExtension中,但我不得不自己定义 NetFx45MinRelease
。
我该如何正确设置?