views:

352

answers:

3

I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after installation. Any info I've found about bootstrapping involves setup and installation of the application. How can I do this if I don't install anything? I'd appeciate any info..

+3  A: 

The msi installer you build with visual studio can include a native setup.exe that checks the framework dependency and kicks off the installer first if needed. You can even include the redistributable on your cd. But you have to install the program for that to work.

Otherwise, you must build your own native code tool.

Joel Coehoorn
+1; the bootstrapper must actually be a separate file due to a limitation of MSI: One MSI installer is not allowed to launch another MSI installation (e.g. the .NET Framework installation)
0xA3
Armagan is not trying to run an MSI file at all. He isn't even installing anything (except .NET if the user doesn't already have it).
Grant
+2  A: 

You could code a small native code loader that checks for .NET runtime, triggers the installation of .NET if necessary, and then starts your .NET application.

Adrian Grigore
+2  A: 

Most straightforward way would be to check for registry entries as listed in this question:

.Net Framework detection

A script file might be the easiest way to check from the CD:

Windows Script Host - RegRead method

Lurker Indeed