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.
Here's my latest setup:
<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>
(For some reason, I had to define NetFx45MinRelease
myself even though it should have been included with WixNetFxExtension.)
How can I get the settings correct?