I have a WinForms app that should be really easy to deploy with just and .exe file. It uses framework 2.0, and so it does not work on Windows 8 by default. If I include a .config file with the following parameters, it works fine on W8:
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
However, now I have to deploy two files and this is not acceptable. Is there some thing I can do to "embed" those parameters into the exe itself?
I have tried using WinZip self extractor, but it's not an option either, because I cannot customize its interface.
The machine configuration file, Machine. config, contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory.
A string value that specifies the stock-keeping unit (SKU), which in turn specifies which . NET Framework release this application supports. Starting with . NET Framework 4.0, the use of the sku attribute is recommended.
.NET executable contains small piece of native code, which is intended to load appropriate CLR version into a process.
Loader calls shim (MSCOREE.DLL, .NET executable has native dependency from this DLL) to load CLR (CLRCreateInstance in v4).
Content of <startup>
configuration element is processed by the shim.
This means, you can't process <startup>
element in managed code, because there's no CLR (and any managed code) at this moment. The only way is to write your own CLR host. I think, it is much easier to ship your application with config file, or build a version for .NET 4/4.5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With