Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for referencing 3rd party assemblies

I have been wondering what are best practices when it comes to referencing 3rd party assemblies. A while ago I asked a question "Dependencies and references: what exactly should I reference" and received something to think about but I am not completely convinced. I have a 3rd party assembly needed for building my project and according to what I have read so far I should only reference assemblies needed for building my project. This leaves the problem of the runtime dependencies of the 3rd party assembly. If I reference those too the list of references becomes huge (as there are several dependencies) and includes a lot of assemblies I have no clue what do and are really not related to my project. Also I want to avoid using public methods in any of those and just use the main 3rd party assembly. How can I go about doing this in a decent way? Any help is appreciated as I am quite confused.

To give an idea of what I am dealing with here is the 3rd party library uses hibernate and log4net along with office interop assemblies.

Thanks.

like image 391
Fadeproof Avatar asked Nov 20 '08 10:11

Fadeproof


1 Answers

If i have to deal with libraries that aren't registered in the GAC, I use the following method:

  • Make a folder "Libs" with all third party libraries and their dependencies in it
  • Reference the ones I need
  • Create a post-build action that copies all the files in the "Libs" folder to the "bin/debug" (or release) folder

If you don't know the dependencies, you can use Dependency Walker.

like image 94
Vincent Van Den Berghe Avatar answered Sep 29 '22 21:09

Vincent Van Den Berghe