8

There are many incomplete questions and answers about how to download and install .NET Framework(s) if they are not available but none complete code seems to be available on Internet.

Can you provide a minimal compilable code or a link to a clear example that generates a setup.exe/MSI? I don't think RTFM applies to this question since MSI and bootstrap installers has a lot of idiosyncrasies that are not easily deductible.

sw.
  • 3,240
  • 2
  • 33
  • 43
  • 3
    Downvotes without comments are not really helpful. – sw. May 18 '13 at 08:07
  • Setup Development is development. It's bad form to ask someone to do your work for you. If you want it to be easy, use InstallShield. You just click the checkbox that says .NET X and then select Download from Web. If it works, great. If it doesn't, the same complexity still exists under the covers. – Christopher Painter May 18 '13 at 11:00
  • 4
    I only agree with you when someone is a lurker. Although setup deployment is development, in terms of community sharing is on the bottom. Your solution is not what I asked for. I am looking for this in the context of WiX. It's trivial to do it in a Visual Studio project. And if I don't receive any answer I will spend the time to solve it myself and share it with everybody. – sw. May 18 '13 at 11:38
  • I've been sharing on my blog for 12 years. I also create an open source project called ISWIX. :) There is a help topic in the WiX CHM that explains how to use Burn to install .NET framework. IT has a link to the NetFx extension but the link is broken. Easy to fix the URL and get it right though. – Christopher Painter May 18 '13 at 11:48
  • @Cristopher I know about you from your community contributions. In this case I was stucked with the missing link, jumped to the forums, and finally post my question here. – sw. May 18 '13 at 12:02

1 Answers1

8

Note, this information is available in full in the manual. It can be found in the following locations with examples:

How To: Install the .NET Framework Using Burn

How To: Check for .NET Framework versions

WixNetfxExtension

That being said

Using WiX, you cannot generate an MSI to install .Net [X]. You can, however, use it to generate a bootstrapped installer executable.

Luckily, including the .Net installer is trivially simple in a WiX Bundle project. Simply include a reference to the WixNetFxExtension.dll (should be in "[Wix Install location]\bin") in your bundle project, and then include the following in your <Chain>:

<PackageGroupRef id="[.Net package]" />

where [.Net package] is:

  • NetFx40Web
  • NetFx40Redist
  • NetFx40ClientWeb
  • NetFx40ClientRedist
  • NetFx45Web
  • NetFx45Redist

For example, a bundle that includes the .Net 4.5 Web installer:

<Bundle Name="E.G." Version="1.0.0.0" Manufacturer="Me" UpgradeCode="[Guid]">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
    <Chain>
        <PackageGroupRef Id="NetFx45Web" />
        <MsiPackage SourceFile="$(var.ExampleInstaller.TargetPath)" />
    </Chain>
</Bundle>

And if you are using the Redist packages, you can run the compiled installer with -layout to download the files so that they can be burned to a CD/DVD (using the Standard Bootsrapper application, custom bootstrapper applications may or may not have similar functionality).

Martin Braun
  • 10,906
  • 9
  • 64
  • 105
XNargaHuntress
  • 751
  • 6
  • 11
  • Does this solution work for enabling .NET Framework 3.5 on Windows 8 instead of downloading it from the web? What's the name of the package for that OR is there any WiX support for this case? Thanks. – sw. May 24 '13 at 14:09
  • 1
    From what I've been able to find, no. If .Net 3.5 is already installed and not enabled, I do not think there is any simple way to enable it from WiX. You could find the registry settings that it corresponds to and mess with them, but that can get...well...messy. For _installing_ .Net 3.5, see [this question](http://stackoverflow.com/questions/12628922/using-wix3-6-to-install-net-framework-3-5-sp1-with-burn) – XNargaHuntress May 24 '13 at 15:08
  • Can you point me in the direction of how to use the `-layout` argument? I've looked for this based on your indication but can't find any documentation or examples of it. – Chris Schiffhauer Jan 09 '14 at 13:27
  • @PaulyGlott, there's not a lot of information available about it that I've found. [This blog post](http://robmensching.com/blog/posts/2010/9/7/burn-in-the-corporate-environment) and [this question](http://stackoverflow.com/questions/16219706/is-there-a-wixbundledirectorylayout-or-a-layout-sample-snippet-i-can-use) might be of some help. – XNargaHuntress Jan 14 '14 at 14:31