.NET Bootstrap without setup

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..


I was also thinking that you can't do it without making an installer for a long time, but that's not true. There is a msbuild action, called "GenerateBootstrapper". If you're in Visual Studio:

  1. Right-click your project
  2. Unload Project
  3. Edit YourProjectName.csproj"

Then you can add GenerateBootstrapper action in different ways (depend on what you want to install). MSDN gives an example for .NET 2.0:

    <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
        <ProductName>Microsoft .NET Framework 2.0</ProductName>

<Target Name="BuildBootstrapper">
        OutputPath="C:\output" />

I didn't try this example, but I tried my own and I can tell you, that in order to install .NET 4 Client Profile (which is the latest stable .NET release for today) on XP machines, you need to install Windows Imaging Component first. That's why standard .NET4 Client Profile prerequisite, included in VS2010, fails on XP. So i wrote my own bootstrapper. You can download my sample VS2010 solution, that creates a bootstrapper for console app. But it requires you to install (just copy) my bootstrapper. So here are the steps:

  1. Download my Windows Imaging Component bootstrapper
  2. Unzip it to %PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
  3. Download my BootstrapperTest solution
  4. Build solution. You'll see that it created BootstrapperTest.exe and setup.exe in \bin\Debug directory. Setup.exe is a bootstrapper, you can run it without .NET installed - it will get it for you and then run BootstrapperTest.exe.
  5. If you want to distribute it as a single file, I recommend using a ChilkAt Zip2Secure or it's analogues. Zip2Secure is very easy to use and I hope you won't have any troubles with it.

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.

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.

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

Need Your Help

iphone .png image not showing up in device

iphone xcode png

ok, i set some .png files image as uimage in my table cell. they show up nicely when i run them using iphone simulator. when i run them in my device, they up not show up. what seems to be the probl...

Printing space and new lines within a loop issue

loops assembly newline mips space

The code i wrote works however during the second loop and onward the newlines and the 'totalmin' string isn't printed. can someone please tell me how to fix this? the loop is correct because the pr...