2

I have a dll project which uses some third party dlls. I would like the compilation result to be just one big dll with all the third party dlls included in it. How can I do this in Visual Studio 2010?

Andrzej Gis
  • 13,706
  • 14
  • 86
  • 130
  • 1
    Side note: it may be against third party dll license to recompile into your own assembly. Check if you care and if you do check with the third party if it is ok. – Alexei Levenkov Jul 10 '12 at 15:59

3 Answers3

3

You need to use ILMerge, assuming the DLLs are all managed:

http://www.microsoft.com/en-us/download/details.aspx?id=17630

And some related questions:

ILMerge Best Practices

ILMerge question

Community
  • 1
  • 1
Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
0

ILMerge is a .NET only solution (does not work for unmanaged dlls)

A nice tool is NETZ (.net executable compresser and packer) which compresses all your dependencies in a single exe / dll file.

I have not used it recently so I can't tell if it is compatible with .NET 4.0 And it didn't get many updates in a while but I would give it a try.

http://madebits.com/netz/

Jürgen Steinblock
  • 30,746
  • 24
  • 119
  • 189
-1

There are several approaches that you can take here to achieve this. Here are a couple:

  1. You could include the source, if available in one project, and then compile it to a single binary.

  2. You can add the external assemblies as resources, and load them dynamically at runtime.

  3. You can use something like Eazfuscator.Net, which uses ILMerge to merge assemblies at compile time. (can also use ILMerge directly, but Eazfuscator has nice wrapper features) Eazfuscator .Net

Grant H.
  • 3,689
  • 2
  • 35
  • 53