[Mono-list] linking multiple .dll-s into a single file

Jonathan Pryor jonpryor@vt.edu
Fri, 30 Jul 2004 23:20:10 -0400


On Fri, 2004-07-16 at 16:43, Mads Lindstrøm wrote:
> Hawdee
> 
> I am currently making a C# program and I want to link
> all my .dll-s and a .exe file into a single
> executable. How do I do this?
> 
> I have searched the net and looked at various
> documentation, but found nothing.

The short answer is that you don't.  At least not easily, not with the
standard tools.

If you *really* need to do this, you can always disassemble all the
assemblies, concatenate them into a single .il file, and compile the
single-file .il file into a .exe.

This is a brute force approach, and will likely require some
modifications to the .il to allow it to compile, but it might work.

Emphasis on *might*.  If any of the assemblies use Assembly.Load() or
Assembly.LoadFrom() with any of the other assemblies, this code will
need to change (as the assembly that would be loaded would now have a
different name).

Suffice it to say, this is a difficult problem, but can be done if your
code isn't too complicated.

 - Jon