Where to store external DLL files?

34,403

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

You should look at NuGet. It's a package management extension for Visual Studio 2010 designed exactly for what you want.

Solution 5

Take a look at NuGet (package manager for Visual Studio)...

NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.

Then read this NuGet doc to get the crème de la crème:

Using NuGet without committing packages to source control

Share:
34,403
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    In my project I'm using some third-party libraries. I include them using the references folder in Visual Studio.

    But where should I save the DLL files? They are referenced from a path in the file system, but it would be nice if I can include it into the project. But how?

  • Heiko Hatzfeld
    Heiko Hatzfeld over 13 years
    +1 for the reminder to add them to the source control... It should be obvious, but its often overlooked.
  • Frederik Gheysels
    Frederik Gheysels over 13 years
    Why is it 'JAVA-esque' ? I mean, I think it's a good practice in all environments. :)
  • Øyvind Bråthen
    Øyvind Bråthen over 13 years
    Same procedure as we use where I work. Important to add to source control to make sure that it will work for all other developers also.
  • deanvmc
    deanvmc almost 13 years
    Cheers, I've been mulling this question over for a few days but that seems like solid advice.
  • Alexander Van Atta
    Alexander Van Atta over 11 years
    I have just started using NuGet and I love it.
  • OnesimusUnbound
    OnesimusUnbound over 11 years
    This is the best answer for any recent development (2011 onwards)
  • Aliostad
    Aliostad over 11 years
    @Tyler no. You will call PM> Update-Package in NuGet console.
  • deed02392
    deed02392 over 10 years
    Can you clarify that when you say 'solution level' you mean at the level where the .sln file is stored?
  • Aliostad
    Aliostad over 10 years
    @ØyvindKnobloch-Bråthen exactly what I mean.
  • Mickey Puri
    Mickey Puri over 10 years
    Thanks, good approach. You mentioned you use NuGet even for managing internal dependencies and have a private feed, are there any good how-to's on doing this, and will it be picked up in the MS Build Task/Targets as well or would they also need some editing?
  • Aliostad
    Aliostad over 10 years
    @MickeyPuri have a look here docs.nuget.org/docs/creating-packages/…
  • Isaac Kleinman
    Isaac Kleinman about 10 years
    Why do you make lib a solution folder and not a project folder? (A project folder is easier to manage with version control.)
  • Khadim Ali
    Khadim Ali about 8 years
    That's great. When I added a lib folder at solution (.sln) level, added the external references to the project from there and updated on GitHub ignoring debug and release folders, the referenced DLLs got compiled/resolved automatically when I downloaded the project from the GitHub again. Thanks @Aliostad