views:

141

answers:

2

I have a C# Application that uses some other Assemblies, so when I compile, I end up with my .exe and 2 or 3 other .dll Files. Ideally, I only want 1 .exe file. At the moment I use ILMerge for that, but as the Assemblies that I use are Open Source (and under the same license), I wonder if there is an easy way to add them to my Solution and compile them into the .exe?

What I do not want:

  • Creating a Subfolder in my main .exe and copying all the other files into it
  • Adding it as a separate solution but then add it to my .exe Project with "Add as Link"

I suppose that ILMerge is more or less doing exactly what I want, but if I can apply the merging on a compiler level already, that would be what I want.

Needless to say, the referenced assemblies have no main() function, so no clashes are to be expected.

+2  A: 

You could add the dependencies as embedded resources and then load them manually but this would require a code change so it's not ideal.

I think that ILMerge is your best option here.

Andrew Hare
+1  A: 

As I never tried this, I don't know if this will work and/or meet your expectations, but, there's an option of compiling .net code to a netmodule, instead of an assembly, and then those modules, theoretically, could be added to other assemblies, You can read about it here and here.

Ravadre