Satisfying indirect references at runtime.

Posted by automatic on Stack Overflow See other posts from Stack Overflow or by automatic
Published on 2010-05-07T12:59:51Z Indexed on 2010/05/07 14:48 UTC
Read the original article Hit count: 140

Filed under:
|

I'm using C# and VS2010. I have a dll that I reference in my project (as a dll reference not a project reference). That dll (a.dll) references another dll that my project doesn't directly use, let's call it b.dll. None of these are in the GAC.

My project compiles fine, but when I run it I get an exception that b.dll can't be found. It's not being copied to the bin directory when my project is compiled.

What is the best way to get b.dll into the bin directory so that it can be found at run time. I've thought of four options.

  1. Use a post compile step to copy b.dll to the bin directory
  2. Add b.dll to my project (as a file) and specify copy to output directory if newer
  3. Add b.dll as a dll reference to my project.
  4. Use ILMerge to combine b.dll with a.dll

I don't like 3 at all because it makes b.dll visible to my project, the other two seem like hacks. Am I missing other solutions? Which is the "right" way? Would a dependency injection framework be able to resolve and load b.dll?

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about .NET