Merging .Net Assemblies into a .DLL/.EXE with ILMerge

Sometimes when I am working on project that have third-party libraries, I want to combine the assembly to ease deployment and to make sure all dependent libraries are available with my application or library. Sometimes I just want to deploy a single file via xcopy. Luckily, ILMerge allows me to merge multiple .NET assesemblies into a single DLL or EXE.

Merging into a DLL

ilmerge.exe /target:library /out:bothassemblies.dll assembly1.dll assembly2.dll

Merging into an EXE

ilmerge.exe /target:winexe /out:bothassemblies.exe assembly1.exe assembly2.dll

Download ILMerge.