Search code examples
visual-studio-2010installation.net-2.0

How to automatically install .NET Framework 2.0 (if missing) on a client computer with Visual Studio 2010 Installer project?


I'm trying to distribute a small windows application I made in Visual Studio 2010 and is targeted to .NET framework 2.0. I've made an installer project, but in the Prerequisites window I can't set .NET framework 2.0. I can only see 3.5 SP1 above. There is a whole list here: http://msdn.microsoft.com/en-us/library/7tx0bw8y(v=VS.100).aspx. I'd like to have earlier versions as well, as are shown here: http://msdn.microsoft.com/en-us/library/7tx0bw8y(v=VS.80).aspx. I can see that the .NET Framework 3.5 SP1 will install 2.0 as well, but I don't want to bother a user that already has 2.0, but not 3.0, 3.5 or 3.5 SP1.

I've also managed to set the Launch Condition to .NET Framework 2.0. I've tested this on a virtual machine that has no .NET Framework and it just asks a user to go to a website to download and install the framework manually. (Also the link actually goes to 4.0 Client Profile. I know where to change the link, but 2.0 has separate x86 and x64 downloads, but you can only enter 1 link.)

All I'm trying to do is for the installer to install the .NET Framework 2.0 automatically if the user doesn't have it and then install my application. It would be great if there was only 1 file, which I can then have people download from my website. So, how can I accomplish this?


Solution

  • You would have to install an old version of the Window SDK (version 6) on your machine to get the bootstrapper for .NET 2.0. Doing so makes little sense:

    • after you install it the user's machine will get updated to .NET 3.5 SP1 by Windows Update.
    • the 2.0 bootstrapper will blow up your installer size to over 50 megabytes, the .NET 3.5 SP1 bootstrapper is a megabyte or so, it selectively downloads what the user needs at install time.
    • you don't want to ship code that you haven't tested on 2.0.