Offen also a simple application references some other assemblies. In those cases for a deployment all of these assemblies are needed. Instead giving the customer a bunch of all, with ILMerge you can bundle all assemblies in one.
To support the merge-process in a post built step in my solution tree is a folder named Build which contains tools for the build-process. One of these tools is ILMerge:
Next thing we need is a simple batch (ILMerge.bat) in the project which calls ILMerge:
The ILMerge call is simple. First we copy the original AedSicad.UT.Application.Egm.Replication.exe to a temp.exe, because we want have the new bundled EXE under the same name. Then we use ILMerge to build the bundle. In a last step the temp.exe should be deleted:
1: ECHO parameter=%1
2: CD %1
3: COPY AedSicad.UT.Application.Egm.Replication.exe temp.exe
4: ..\..\Build\ILMerge\ILMerge.exe /out:AedSicad.UT.Application.Egm.Replication.exe temp.exe AedSicad.UT.Application.Egm.Replication.Engine.dll EsriDE.ArcGIS.Commons.Logging.dll log4net.dll
5: DEL temp.exe
The last step is the post build command:
1: $(ProjectDir)ILMerge.bat $(OutDir)
The result is AedSicad.UT.Application.Egm.Replication.exe which contains all referenced assemblies. In this case the log4net assembly and an own wrapper for logging-stuff.