如何使用WiX捆绑包安装.NET 4.5? [英] How to install .NET 4.5 with a WiX bundle?
问题描述
我需要将Microsoft .NET 4.5包括在内,作为我的安装捆绑包的先决条件,并且我希望它尽可能自动。但是,.NET应当在删除时 not 删除。我想我已经阅读了有关如何使用 DetectCondition
和/或 InstallCondition
的所有内容,但我仍然没有正确处理;
I need to include Microsoft .NET 4.5 as a prerequisite with my installation bundle, and I want it as automatic as possible. However, .NET should not be removed when unistalling. I think I have read just about everything on how to use DetectCondition
and/or InstallCondition
, but I'm still not getting it right; it is either always running the .NET installation, or never running it.
这是我最新的设置:
<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中。)
(For some reason, I had to define NetFx45MinRelease
myself even though it should have been included with WixNetFxExtension.)
如何正确设置?
推荐答案
我不太确定您为什么会遇到问题,但是我只是完成了同样的任务,并且它(现在是;-)按预期工作。也就是说,仅在需要时才安装 .NET 4.5,并且在卸载引导程序时不会进行.NET卸载
I'm not quite sure why you're having problems, but I just had the same task, and it (now ;-) works as intended. That is, it installs .NET 4.5 only if required, and won't do a .NET uninstall when uninstalling the bootstrapper as a whole.
但是,.NET 4.5 可以单独卸载,我认为这很好。
However, .NET 4.5 can be uninstalled individually, which I think is good.
这就是我使用的内容(很可能来自其他Stack Overflow帖子):
This is what I used (most probably derived from other Stack Overflow posts):
<PackageGroup Id="Netfx45Xxx">
<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="C:\wixtest\dotnetfx45_full_x86_x64.exe"
DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709"))"/>
</PackageGroup>
奇怪的是,您已经拥有Permanent = yes,这对于保持至关重要。
The strange thing is that you already have Permanent="yes", which indeed is key to keeping .NET on uninstall.
一个区别是,我在InstallCondition中没有明确的 NOT REMOVE字样,也许这比Windows Installer更容易混淆...?
One difference is that I have no explicit "NOT REMOVE" in the InstallCondition, maybe that is more confusing than helpful to Windows Installer...?
我使用的是最新的WiX 3.7.1224.0。
I am using WiX 3.7.1224.0, which currently is the latest.
对TheESJ答案的一个评论:即使使用预定义的PackageGroupRef,您也可以提供本地文件以避免下载。只需将其放在引导程序EXE文件下面的 redist文件夹中,如果没有下载,它将直接从那里获取。安装错误后,昨天我通过日志文件发现了此行为。
One comment to TheESJ's answer: even with the predefined PackageGroupRef, you can supply a local file to avoid downloading. Simply place it in a "redist" folder below your bootstrapper EXE file, and it will be taken from there if present without downloading. I found this behaviour yesterday via the log file after a faulty install.
这篇关于如何使用WiX捆绑包安装.NET 4.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!