3

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.

1
  • I actually don't see what the problem is with having ILMerge as a post-build step. I do the same and it just works seamlessly without any trouble. Commented Aug 6, 2009 at 13:58

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.