0

I am developing a net compact framework project in sharpdevelop 3.2. It works great but there have to be dlls like firebird net provider and other assemblies i use, inside folder with exe when i run it. How to embed all this dll's into exe, to have it embedded all in one exe file and not need to copy paste them separetely into folder where i run exe from?

user3762355
  • 185
  • 1
  • 12

1 Answers1

0

The method I use most often for this sort of thing is to add the assemblies to the EXE as resources, then add a handler for the AssemblyResolve event to unpack the assembly from resource into memory and load from there.

The nice part of using AssemblyResolve is that you can override the resource-bound assemblies with an actual assembly on disk if necessary, since it won't call AssemblyResolve until it fails to find the assembly through normal means. If you prefer to force it to always load the resource, hook AssemblyLoad instead.

You can also compress the resources to reduce bloat, saving on total deployed bytes.

Corey
  • 15,524
  • 2
  • 35
  • 68