Andrzej Gis
Andrzej Gis

Reputation: 14306

Compile some dlls into another dll

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?

Upvotes: 2

Views: 4700

Answers (3)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31723

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/

Upvotes: 0

Grant H.
Grant H.

Reputation: 3717

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

Upvotes: -1

Adam Houldsworth
Adam Houldsworth

Reputation: 64487

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

Upvotes: 3

Related Questions