views:

712

answers:

4

What would be the ideal location (directory) to check in Third Party Reference Dll's for a .NET Project in a version control system. Typically i have seen most people to put them under bin, so that the runtime can automatically pickup these files. However is that the right way to go.

I originally wanted to have a separate directory which is parallel to bin called lib which will contain all third party Dll's , but this needs changes to the applications config file so that the lib directory is picked up by the run time. My idea over here is that lib will contain third party dll's while bin will contain the projects Binary (could be Dll or Exe)

What is the preferred way, The concentration over is the location in the Version Control and not just the Physical File System.

+6  A: 

Have the separate directory contain the third-party assemblies (this will make things easier to maintain in source control) and then create references in your project to those assemblies. Then, on build, your third-party assemblies will be copied into your \bin and you won't have to make any configuration changes.

Andrew Hare
Yeah, this is the method I almost always see. A "Libraries" directory under the root directory from which you reference all DLLs in your project is the way to go.
Noldorin
A: 

I create a separate (version controlled) directory for third party DLLs. As long as you add them as project references they will be copied to the bin directory when you build.

Mitch Wheat
+4  A: 

We use the following directory structure:

Solution\
  Libraries\
    third-party DLLs here
  Source\
    Project1\
    Project2\

Each project references (using the "Browse" tab in the Add Reference dialog) the assemblies in the "Libraries" folder. These are automatically copied to each project's "bin" folder at compile time. (The "Libraries" folder is, of course, committed to version control.)

Bradley Grainger
One reason i wanted to have a seperate lib dir, is that i dont like the way VS copies over dll's to bin dir, so i wanted the reference path and thr runtime path of the dll to be the same relative path. FYI, this is how we already have as of now at solution level.
Dinesh Manne
A: 

I assume those 3rd party DLLs would be used in more that one project of yours. Therefore putting the DLL directly under bin of every project means you end-up having as many DLL copies (in the VCS) as there are projects, which is not elegant. As Andrew H. mentionned, if the DLLs are truly common, they should be put in a common directory that will be refered to by all other projects that need it. The only catch here is being able to distinguish different versions of the same DLL: over time, you may end up with something like:

/common/ThirdPartyLibrary.dll  (version 1.2)    
/common/ThirdPartyLibrary.dll  (version 1.3)

The best way I know (for now) around that is renaming the 3rd party DLL with an explicit version number and refer to that new name in your project, such that your project will always, for sure, refer to the right version. Like:

/common/ThirdPartyLibrary_v1.2.dll    
/common/ThirdPartyLibrary_v1.3.dll
SClark