问题
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.
回答1:
Why not use ClickOnce, and it will do all that for you.
回答2:
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.
来源:https://stackoverflow.com/questions/852550/installing-net-framework-from-usb-drive-when-necessary