Say I have a .NET/CLR program Hello.exe (or a DLL Hello.dll) that depends on various third-party .NET DLLs. I want to ship a single file, without providing an actual "installer", so I am looking for some software that can pack all of the dependencies into the executable, then load them before any of my code starts to run.

I also need it to unconditionally load every DLL that is supplied, not only "on-demand", because some of the types in the DLLs are accessed via reflection and so the class loader will never attempt to explicitly load the DLL and thus call the class loader hook. I don't want to have to add code to my executable if it's possible to do this without any of my own code.

I am using SharpDevelop and .NET Framework 4.0 Full Profile, but the ideal solution to this problem will be IDE-agnostic, and work with .NET 3.0 or later (2.0 would be even better, but let's not get greedy...)

  • You could potentially pack the assemblies in to a single file and then, upon application load - throw them in to a temporary directory for possible loading and then use Assembly.LoadFrom to do the actual work?
    – Moo-Juice
    Feb 4, 2014 at 22:28
  • Are these third-part DLLs managed or native? Do you need to pack .NET framework too, i.e. run your app without installation of .NET?
    – user626528
    May 20, 2014 at 21:00
  • No, I don't need to run the app without the .NET Framework installed. The third-party DLLs are mostly pure .NET assemblies, but some are native. May 21, 2014 at 14:12

3 Answers 3


How about ILMerge? Its been around for a long time and there's lot of resources. For example, here is a quick intro. Also stackoverflow questions have already covered some common pitfalls, like Merging DLL with EXE.

It is also independent from your build environment. You just need to embed it into your build process.

ILMerge sadly is not perfect. For example, it does not support merging of WPF assemblies. The alternative is to embed the libraries as resources and dynamically load them. For example see this blog post. LibZ Container which allquixotic mentioned is basically doing that.

To LibZ container, there is another alternative, one that is tried and I would give serious thought: Fody.Costura

Mono mkbundle might be yet another alternative, please note however that it produces native code. Dependencies can be statically linked. On Windows, it also requires cygwin to be able to run (also see this forum thread)


LibZ Container instruments your main assembly with code that unpacks zipped assembly resources from the resource file, and loads them from memory. It claims to work with reflection code as well as strong names, and it doesn't modify the original assembly files in any way, so strong-named references will work fine.

  • 2
    Could you elaborate a bit more about this tool? Add some personal experience to your recommendation? Is it easy to configure / use? Maybe add an example? Feb 9, 2014 at 19:36

il-repack partially satisfies the criteria of the answer, but it unfortunately re-packs the assemblies, which breaks their strong name, so if you depend on assemblies signed with a strong name, this won't work. It also doesn't work with most reflection code until after the assemblies have been class-loaded.

  • 3
    Could you elaborate a bit more about this tool? Add some personal experience to your recommendation? Is it easy to configure / use? Maybe add an example? Feb 9, 2014 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.