views:

233

answers:

3

What is the best way to ensure that a user who wants to install my application has .Net 2.0 installed on their computer? I don't really want to use a normal setup project created using Visual Studio, because my application is a portable application and does not use the registry or need an Add and Remove Programs entry. It needs to be as simple as possible for the users to use (because some might not be very computer literate).

Edit: I accepted MusiGenesis's answer because it is the simplest for both me and the users. I am going to add a link to the .Net 2.0 installer from the web site where they download my application.

In the future, I might combine all three answers and write a simple C++ prerequisite checking app that the users could run before they install my application.

+2  A: 

I don't see how. Being a .NET application, it would require .NET to run, thus you couldn't check for .NET prerequisites unless you coded a boot strap in C++. But then that would have to run as a separate application to boot up your .NET application.

Jaimal Chohan
You could do the dual installer in Delphi (we've done this at my company), but it's really not worth the hassle since most users already have at least .Net 2.0, and if they don't it's really no trouble to just download the thing and run it.
MusiGenesis
+4  A: 

If you're distributing your application from a web site, include a link to the .Net 2.0 redistributable installer (it's "only" about 23 MB). If you're distributing it from a CD or something, include the redistributable on the disk.

You can also create an MSI that includes the .Net redistributable, but then your MSI would be 23+ MB, and most users already have .Net 2.0 installed, so it would be useless.

MusiGenesis
If you're distributing via webiste, might it be possible to use the Click Once (i think thats what its called) installer? I don't know too much about how it works tho.
Jaimal Chohan
@Jaimal: Click Once is incorporated into a .Net application, so it can't work unless .Net is already installed.
MusiGenesis
+1  A: 

You have to do the checks in registry or in filesystem. In registry you can enumerate keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP, the keys are versions installed. Or you can explore folder names in c:\Windows\Microsoft.NET\Framework. But for more sophisticated detection I would use this code.

Yakeen
@Yakeen: his app is a .Net 2.0 app, which means he can't check if .Net 2.0 is installed unless .Net 2.0 is already installed.
MusiGenesis