0
votes

We have a .NET application that will be distributed through USB drive. End users will connect the drive and double click on the EXE (a .NET exe) to run it WITHOUT installing it.

Now the problem is, if .NET is not installed we would like to trigger the .NET installer instead of showing the default download message that MS has put there. The installer will be distributed with the application through the USB.

One way to do it might be by replacing the PE stub file in the .NET executable. But I am not seeing and /STUB switch in C# compiler (though C compilers had it).

Anything else anyone can think of?

Update: Thanks to Tim Robinson, I understand that Windows doesn't process the PE stub file. Therefore the ClickOnce solution seems the only viable one left. I shall be checking ClickOnce.

2
How about just making a small Win32 PE-executable that checks for, and starts, the .NET runtime before starting the actual program?Lasse V. Karlsen
The PE stub is just there in case somebody runs your program without even installing Windows. As far as Windows is concerned, the only thing special about your program is that it's missing a DLL.Tim Robinson

2 Answers

3
votes

Why not use ClickOnce, and it will do all that for you.

2
votes

You may want to check out this Episode of Hanselminutes

http://www.hanselman.com/blog/HanselminutesPodcast138PaintNETWithRickBrewster.aspx

He talks with the creator of Paint.NET who ends up doing some pretty creative things with the installer.