Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location of Third Party Dll's in Version Control for .NET Project

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.

like image 894
Dinesh Manne Avatar asked Apr 18 '09 11:04

Dinesh Manne


People also ask

Where are DLL files located?

Your DLL files are located in C:\Windows\System32. When Windows Defender runs a Full Scan, it includes that directory and so all of your DLLs will be scanned.

What is a third party DLL?

Third party DLLs are libraries created by other organisation outside of yours. You can use these third party DLLs by putting them into a folder in your solution and then creating a reference to it (Project-> Right Click-> Add Reference). Once you have the DLL, that DLL will have a namespace.

How do I change the DLL version number in Visual Studio?

Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > Linker > General property page. Modify the Version property.


3 Answers

We use the following directory structure (more details available on my blog):

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.)

like image 180
Bradley Grainger Avatar answered Oct 21 '22 01:10

Bradley Grainger


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.

like image 9
Andrew Hare Avatar answered Oct 21 '22 02:10

Andrew Hare


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
like image 2
SClark Avatar answered Oct 21 '22 01:10

SClark