views:

1146

answers:

4

We have various solutions with various numbers of projects in them. All checked in to a Team Foundation Server source control thing. Most of them builds as Class Libraries.

Anyways, we now want to use some 3rd party external assemblies in our project. And I am wondering how to best do that. Cause we of course want to have those assemblies so that everyone can build without trouble, and also so that we know where we have them. So I am thinking that they should be in the source control with the rest of the code. Which they probably should be. But where? Where do you put stuff like this?

I put the first one in a folder in one of the projects, but I see now that that is perhaps a not so good idea, since I would like to use them in many of the other projects as well. So what do i do? Should I create an empty bogus project for external assemblies? Should I just create a folder for them in source control? How do you guys organize these things?

+3  A: 

The third-party assemblies on which your project depends should definitely be in source control. Your build process should be able to get everything it requires (except operating system and core .NET framework stuff) from source control. You should not require specific third-party software to be installed on your build machine..

Here's how I tend to organise this stuff in TFVC:

Create a separate team project called something like "Common" or "Shared" to hold these third-party binaries.

Branch the binaries as required over to a "Solution Items" folder in each project that requires a reference to these assemblies.

So, for example, you might end up with something like this structure:

$
|-Common
| |-Binaries
|   |-Microsoft
|     |-EnterpriseLibrary
|       |-2.0
|         |-Microsoft.Practices.ObjectBuilder.dll
|-YourTeamProject
| |-Branches
  |-Trunk
    |-Source
    | |-Solution Items
    | |  |-Microsoft.Practices.ObjectBuilder.dll
    | |-YourProject
    |-Tests

where the copy of the MS dll in YourTeamProject is a branched copy of the assembly in Common.

When referencing the third-party binaries from your project, be sure to use relative File References to the copies of the dll in your "Solution Items" folder. In this way everyone on the team knows where to find the binaries that are referenced by the various projects in your solution, and the relative paths should be the same for each member of your team.

In this way, you only have a single copy of each version of the third-party assembly in your source control. Also, should the third-party release a bugfix version of the assembly, you can update your copy in Common, and merge the changes across to all your projects which make use of it.

Ian Nelson
branch? how would that work? could you give an example?
Svish
if you have branched those binaries out to many projects. is it easy to merge in an update into all of them? or do you have to do that manually one by one?
Svish
@Svish, as far as I know, you would have to do it manually one by one. If someone knows how to do it en masse, I'd love to know!
Ian Nelson
Is there a special reason why the projects wouldn't just link to the same dll up there in Common?
Svish
@Svish - if you reference dlls in a different team project, you'll need to configure your build process to download those files, which is possible but non-trivial. I like to have a copy of all a project's dependencies within the same team project where possible.
Ian Nelson
A: 

Create a new folder under your TFS solution, for instance shared libraries, and dump the assemblies in there.

fARcRY
+3  A: 

We keep them under the branch, in a Binaries directory:

$/project
  - Main
     - Binaries
     - Source

Then they branch and version as needed. Although, Ian's way might work better if you have larger needs.

MichaelGG
this one sounded a bit simpler though.
Svish
This is easily the simpler method and the one I prefer.
Mr. Kraus
+1  A: 

I had a question similar to yours, and came across the following link: Managing Source Control Dependencies in Visual Studio Team System

It goes into significant depth on four different dependency management scenarios. The article advocates what appears to be a similar branching solution to the one Ian Nelson mentioned.

Scott A. Lawrence