Dienstag, 1. Dezember 2015

Installing .NET versions with wix bundles (and determine which one is already installed)

There's a nice help page from MS:
Which .NET does come with which OS and how do I determine what is installed: https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx

For msi packages, there's an extension which does this work for you and determines whether e.g. .net 4.5 is installed: WixNetfxExtension, but the suggested PropertyRef (<PropertyRef Id="NETFRAMEWORK45"/>) doesn't work with burn.

So, for the bundle, the game is slightly different. Just do a:
<util:RegistrySearchRef Id="NETFRAMEWORK45"/>
this needs the utils extension.

And it'll only give you a version number, so you'll have to check against that. Which .net has which version number can be gleaned from the first link to MS, or from here.

Of course, there's already a stackoverflow answer for that :)

And finally, to install e.g. .NET 4.5 with your bundle, you can use this magic package group id in the chain if you use the NetFxExtension:

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

That should make the bundle download the appropriate .NET framework. See also here: http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html