Where to Store 3rd Party Assemblies

Several times now I've come across the question of where to store 3rd party assemblies when your projects are managed by source control. A colleague had decided to store a copy of each assembly in each project's bin folder and check those into source control. This meant quite a few things that I wasn't quite fond of. The first most obvious problem with this is that every project has to have a copy of the exact same DLL. This is a waste of space. Another problem is that the bin folders in projects should never be checked into source control since their contents are generated during project builds, but with this configuration the bin folder and all 3rd party assemblies had to be checked in. I knew there had to be a better way.

Now that I'm putting it down in writing the solution seems so obvious, but it can be confusing sometimes when trying to figure out what the best way to manage these things is. We ended up adding a directory called "Assemblies" to the root of the branch in source control. This directory isn't part of our projects or solution, but it is managed by source control. Then each project references the 3rd party assemblies from that directory. At first I did not think this would work as I thought the assembly references were fully-qualified file paths, but it turns out they are relative file paths. That means you can safely create a new branch in source control and all your references will resolve just fine :)

Happy coding everyone!

Chev

Read more posts by this author.

comments powered by Disqus