How to link in one exe file

Public forum to share code snippets, screen shorts, experiences, etc.
Post Reply
Frank Maraite
Posts: 176
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

How to link in one exe file

Post by Frank Maraite »

Hi all,

some people, Horst for example, like to deliver only one exe file instead of a bunch of dll's.

There is a little program that does this for us: ILMerge. I use it in a little batch file MergeMyProgram.bat that contains:

Code: Select all

del YourApp.LOG
"C:Program Files (x86)MicrosoftILMergeilmerge" /allowdup /out:"D:OutputPathYourApp.exe" "YourApp.exe" "YourAssemblyOne.dll" "YourAssemblyTwo.dll"  /log:YourApp.LOG /targetplatform:v4,C:WINDOWSMicrosoft.NETFrameworkv4.0.30319
These are only two lines! All options must be in one line.

This works not always. For example it does not work if WPF is involved. I don't no why. But for CGI programs (Horst) this could be a possible way to avoid putting all assemblies in the GAC.

If you search for 'ilmerge alternative' you will find additional information, for example this one: ... ssemblies/
and this

Post Reply