14
votes

I've created a WiX installer which I want to install .NET 4.5 if it is missing.

To do this, I've added <PackageGroupRef Id="NetFx45Web" /> to my chain.

The strange problem I have is, on a machine with .Net 3.5 (Windows Vista), everything works fine and WiX installs .NET 4.5 correctly, but on a machine with .NET 4.0 (Windows 7), nothing happens and the installer just executes my application without installing .NET 4.5 first, which then crashes because it requires .NET 4.5

Is there anything I'm missing or is this a bug?

2
Posting what's in the log might help. You should be able to find it in C:\Users\username\AppData\Local\Temp\Rick Bowerman
.net 4.5 is built on top of 4.0... which means 4.0 "can look like" 4.5 if not checked correctly. How does WIX check if 4.5 or 4.0 is installed?Vlad
Which version of WiX are you using? There doesn't seem to be any problem with the latest code in NetFx4.5.wxs for branches wix38, wix39 or wix40 from wix.codeplex.com/SourceControl/latest. Do you have any other sort of condition where you're trying to detect .Net?kjbartel
I just recalled that we had a similar problem installing .Net 4.0 on a machine which had the .Net 4.0 Client Profile installed. I think Windows 7 which is updated with latest updates will only have .Net 4.0 client profile installed and not the full version. Trying to remember I think the solution was to change the <supportedFramework version="v4.5\Client" /> line in the bootstrappercore.config file.kjbartel

2 Answers

3
votes

I assume that you're using the NetFx45Web package from the NetFxExtension, which means you're using WiX's built in way of detecting it.

I'm guessing that by application, you mean your managed BA. You have to make sure you setup your BootstrapperCore.config properly. If your MBA needs 4.5 or later, then make sure the supportedRuntime element has 4.5 and not 4, same with the supportedFramework element.

2
votes

If you're using a managed Bootstrapper Application then you should make sure that the supportedFramework set in the BA is the same as the supported framework of your actual application. Specifically, if your application requires the Full .Net 4.5 version then make sure you do not have the Client Profile version set as a supported framework otherwise the BA will not download and install the Full version if it finds the Client Profile installed. I personally think this is a bug in the managed BA however it was reported to WiX and closed as "notabug". So, remove this from you BootstrapperCore.config:

<supportedFramework version="v4.5\Client" />