4

I have a bootstrapper project for my installer. The bootstrapper installs the .NET, SQLExpress, IIS, and my app. I'd like to install the .NET4.5, if the OS is Windows Vista, or higher, and the .NET4.0 if it's XP.

I use a simple PackageGroupRef in the <Chain> element, using the WixNetFxExtension dll:

<Chain>
  <PackageGroupRef Id="NetFx45Web"/>
  <PackageGroupRef Id="DotNetInstall"/>
</Chain>

Is there a way, to insert a condition to the PackageGroupRef? Or I have to write my own .NET installer package?

Thanks!

Nagy Vilmos
  • 1,878
  • 22
  • 46

2 Answers2

3

I think I found a solution.

I've created two more Wix Burn projects, one for install the .NET4.5, and on for install the .NET4.0. Something like this:

<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="VilmosNagy" UpgradeCode="844c755f-f02b-4dd3-8b9c-af2498f3128c">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
    <Chain>
      <PackageGroupRef Id="NetFx40Web"/>
    </Chain>
  </Bundle>
</Wix>

And one for the .NET4.5. I compiled theese to .exe files. After I inserted into the original project one Packagegroup, which installs one of theese .exes, based on the Windows version. Something like this:

<PackageGroup Id="DotNetInstall">
  <ExePackage Id="Net45Installer"
              Name="Net45Installer.exe"
              InstallCommand="-q"
              InstallCondition="VersionNT &gt; v6.0"/>
  <ExePackage Id="Net40Installer"
              Name="Net40Installer.exe"
              InstallCommand="-q"
              InstallCondition="VersionNT &lt; v6.1"/>
</PackageGroup>

It installs the .NET4.0 on XP. I'm trying it out on Win7, but I think (I hope) it'll be right.

Nagy Vilmos
  • 1,878
  • 22
  • 46
  • Alternative you can can use the original "NetFx40Web" and "NetFx40Web" in your code and add conditions. https://wix.codeplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx4.wxs and https://wix.codeplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx4.5.wxs – Morten Frederiksen Jul 03 '14 at 15:37
  • 1
    Cannot open your links. But I'd like to put it in a Burn project, and the original "NetFx40Web" and "NetFx45Web" is a `PackageGroupRef`. And I cannot give condition to a `PackageGroupRef`. Can you show an example, where a `PackageGroupRef` has a condition? – Nagy Vilmos Jul 03 '14 at 15:43
  • Codeplex.com is inaccessible for me too right now. Try later. I have the same problem as you, and also would like to have a condition on a PackageGroupRef - however I don't think that it is supported. – Morten Frederiksen Jul 03 '14 at 15:50
1

In 3.9 and earlier the conditions are fixed in the provided extension, but you could include the source from github 3.9 or maybe github 3.10 with some modifications to package id and to modify for the condition you want.

In 3.10.. the DetectCondition and InstallCondition is customizable. github 3.10.2 netfx4.6

<WixVariable Id="NetFx45WebDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx45MinRelease)" Overridable="yes" />
<WixVariable Id="NetFx45WebInstallCondition" Value="" Overridable="yes" />
<WixVariable Id="NetFx45WebPackageDirectory" Value="redist\" Overridable="yes" />
Greg Domjan
  • 13,943
  • 6
  • 43
  • 59