ILMerge Best Practices

I use ILMerge for almost all of my different applications. I have it integrated right into the release build process so what I end up with is one exe per application with no extra dll’s.

You can’t ILMerge any C++ assemblies that have native code.
You also can’t ILMerge any assemblies that contain XAML for WPF (at least I haven’t had any success with that). It complains at runtime that the resources cannot be located.

I did write a wrapper executable for ILMerge where I pass in the startup exe name for the project I want to merge, and an output exe name, and then it reflects the dependent assemblies and calls ILMerge with the appropriate command line parameters. It is much easier now when I add new assemblies to the project, I don’t have to remember to update the build script.

Leave a Comment