Question

I'm compiling C# code using CodeDom. Even when there are no resources specified, it still compiles a Win32Resource called "VERSIONINFO". I know I can remove it with BeginUpdateResource after it is compiled, but that will leave "PADDINGXXPADDINGXX" in the file, which I don't want. Is there a way to compile C# code to .exe without any resources?

Was it helpful?

Solution

Fretting about this is actually fairly troublesome. The EXE doesn't just contain the VERSIONINFO resource, it also has a manifest. Best way to see it is open the EXE in Visual Studio with File + Open + File. The manifest is under the RT_MANIFEST node.

It is important because it declares your program to be UAC compatible. Without it, Windows treats it like a legacy Windows app. Which some pretty unpredictable behavior, remapping file and registry access to isolated storage.

You can get what you want. Create an empty .rc text file in Notepad (not Visual Studio) and compile it with rc.exe to a .res file. Use /win32manifest in your CompilerOptions to force the compiler to use it so that it omits the auto-generated native resources.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top