1

Is there a way to build my exe that other references will be embedded? for example. the System.Data.Entity.dll.

roybalderama
  • 1,650
  • 21
  • 38

3 Answers3

1

ILMerge - Microsoft Research is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft Research page.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • Yeah. I did some research about that. But it fails on merging. Can you site an example for this? or things I need to assure first before merging? Thanks for fast response though – roybalderama Feb 26 '13 at 05:04
  • Sharing your research helps everyone. Can you edit your question and tell us what the error is? Thanks. Looking around the "fails on merging" seems be quite well known: http://stackoverflow.com/questions/1807652/ilmerge-dll-not-merged-in-correctly and http://stackoverflow.com/questions/9376/ilmerge-best-practices – Jeremy Thompson Feb 26 '13 at 05:06
1

Optionally:

If you are using Visual Studio w/Nuget, you can simply set your needed reference to 'copy local = true' and install Fody.Costura.

You can refine things a bit using a simple xml file, per the documentation provided on the project page (as well as tidy-up your build directory if desired).

Handprint
  • 444
  • 2
  • 4
  • 13
  • I second this. Once it's installed, it automatically combines everything into the exe. A classic case of "it just works". – Steve Smith May 12 '17 at 10:43
0

One way is to embed the dll as a resource, then extract it to the filesystem at run time and then dynamically load it.

Although it is hard to imagine why you would need to do this - there are various installation mechanisms that allow you to package multiple files and deploy them together.

slugster
  • 49,403
  • 14
  • 95
  • 145