Levén Labs / Snippets

Single File Assembly generator

Simple DOS Batch-script to combine several .NET assemblies into one executable (EXE) or dynamic link library (DLL)

Using the tool ILMerge from Microsoft we can combine several assemblies into one.

You need to get ILMerge from Microsoft's website Tools & Utilities on MSDN or go direct to the download page for ILMerge.

Template Batch-script (.BAT)

ILMerge.exe /out:YourOutput.exe YourMainAssembly.exe YourOtherAssembly1.dll YourOtherAssembly2.dll YourOtherAssembly3.dll

YourOutput.exe The name of your output file
YourMainAssembly.exe Your main (executing) assembly to integrate into the single output file
YourOtherAssembly{n}.dll Your additional assemblies to integrate into output file

Example Batch-script

ILMerge.exe /out:StartMe.exe "My Windows App.exe" "My Code Library.dll" "Third Party Code Library.dll"

This would take one Windows application and combine it with two Dynamic Link Libraries and output a single redistributable application called StartMe.exe.

Other resources:
If you don't like doing it yourself you can always check out the GUI tools for ILMerge.