2

I have to build an installer for an .NET application that requires .NET Framework 2.0 SP2. When I add the .NET Framework as found in WiX Tutorial I get the .NET Framework 2.0 without service pack.

What is necessary to get the required service pack 2 into the installation?

Edit: Is there any chance to rebuild an installer without the service pack when Windows Update has installed the service pack for the current .NET framework?

harper
  • 13,345
  • 8
  • 56
  • 105
  • Why not just require .NET 3 / 3.5 / 4? .NET applications are backwards-compatible, so a .NET 2.0 application will run on a computer that has .NET 4 installed. – qJake Oct 17 '11 at 14:43
  • This would force an installation of .NET framework even if .NET 2.0 SP 2 is already installed, wouldn't it? – harper Oct 19 '11 at 06:24
  • Related to [Wix 3.6](http://stackoverflow.com/q/9021189/147211) – KMoraz Feb 10 '12 at 00:13

1 Answers1

1

From the WiX Doco: (Not sure if that helps the 'Edit' part of your question)

Once the property is referenced you can use it in any WiX condition statement. For example, the following condition blocks installation if .NET Framework 2.0 is not installed.

<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR NETFRAMEWORK20]]>
</Condition>

Installed is a Windows Installer property that ensures the check is only done when the user is installing the application, rather than on a repair or remove. The NETFRAMEWORK20 part of the condition will pass if .NET Framework 2.0 installed. If it is not set the installer will display the error message then abort the installation process.

To check against the service pack level of the framework use the *_SP_LEVEL properties. The following condition blocks installation if .NET Framework 3.0 SP1 is not present on the machine.

<Condition Message="This application requires .NET Framework 3.0 SP1. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR (NETFRAMEWORK30_SP_LEVEL and NOT NETFRAMEWORK30_SP_LEVEL = "#0")]]>
</Condition>

As with the previous example Installed prevents the check from running when the user is doing a repair or remove. The NETFRAMEWORK30_SP_LEVEL property is set to "#1" if Service Pack 1 is present. Since there is no way to do a numerical comparison against a value with a # in front of it, the condition first checks to see if the NETFRAMEWORK30_SP_LEVEL is set and the confirms that it is set to a number. This will correctly indicate whether any service pack for .NET 3.0 is installed.

Jonno
  • 1,976
  • 2
  • 21
  • 21
  • This aborts the installation, when not .NET2SP2 is installed. But I want to build in installer _with .NET2SP2_. – harper Jul 10 '12 at 11:10
  • I see. I haven't tried this, but using the conditions in the doco (i.e. if it's missing) you could use the actual .NET2SP2 standalone installer from http://www.microsoft.com/en-us/download/details.aspx?id=1639. So you could either include a download URL or include it with your installer (paying 20-50MBs more) and use Burn to chain them. Remember to check and allow for a later version of .net (i.e. if your clients have .net 4.0 just skip). Just a thought. – Jonno Jul 11 '12 at 00:47
  • Here's a working example (although not .net 2.0, I'm sure it can be used): http://stackoverflow.com/questions/8117760/wix-3-6-burn-bootstrapping-sequence-validation-issue – Jonno Jul 11 '12 at 01:03