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

infodate infodate@aster.pl
Sat, 31 Jul 2004 13:50:09 +0200


It is problem which was solved by creating a tool called lazy linker ( or
similar name ) described by Serge Lidin book on ILAsm and available on
GotDotNet for download. It handles some of the issues when combining
assemblies (removal of duplicate assembly declarations etc etc) but is
unable to handle all of them and in particular any code using reflection to
work with assemblies.

Why not give it a try?



-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Saturday, July 31, 2004 5:20 AM
To: Mads Lindstrom
Cc: mono-list@lists.ximian.com
Subject: Re: [Mono-list] linking multiple .dll-s into a single file

On Fri, 2004-07-16 at 16:43, Mads Lindstrom 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

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

 - Jon

Mono-list maillist  -  Mono-list@lists.ximian.com