Where to store external DLL files? Where to store external DLL files? wpf wpf

Where to store external DLL files?


This is what I do:

  • Create a lib folder at the solution level
  • Download and copy all my third-party DLL files into there
  • Reference from the lib folder
  • Put all those DLL files in the source control. I am using Subversion, and I add them manually but this is one-off.

You can also add a solution folder and add them there.


UPDATE 2012-12-19

The answer above was when NuGet was in infancy. FWIW, my approach where we have NuGet items:

  1. Do as above for plain DLL file dependencies (where they don't have a NuGet pkg)
  2. Enable "Package Restore" for the solution
  3. Change packages.config file if needed to lock down the version to a particular package
  4. Do not store the package themselves in the version control system (set ignore for Git, Mercurial, etc.)

I actually use NuGet for managing even internal dependencies and have a private feed.


Typically, the structure of my projects looks like this (at a minimum):

projectname   - trunk       - src       - lib   - support       - docs   - releases

The trunk folder contains the copy of the source that I am working on right now. Also, there's a directory 'lib', which contains all the third-party assemblies that are referenced by my project.
(I reference the assemblies at that position).

The 'releases' folder contains branches of the trunk. For instance, when v1 is released, a branch is taken of the trunk so that I have a copy of the source code and all its dependencies that is necessary to build version 1 of the application. (This is handy for bugfixes. Fix the bug in that branch, merge the fix to the trunk, rebuild that branch and you have a fixed v1 of your application).

All these things go into source control. (Yes, the referenced assemblies as well). By doing so, it is very easy if another colleague has to work on the project as well. He just gets the latest version from source-control, and he (or she) has everything in place in order to be able to compile and build).

(Note that this is also true if you use something like CruiseControl for continuous integration).


In the properties window of Visual Studio for the reference to the dll, there is a Property called 'Copy Local' - set this to true, and they'll be copied to your local project's bin directory