tags:

views:

1310

answers:

3

We have just gotten TFS 2010 up and running. We will be migrating our source into TFS but I have a question on how to organize the code.

TFS 2010 has a new concept of project collections so I have decided that different groups within our organization will get their own group. My team develops many different web applications and we have several shared components. We also use a few third party components (such as telerik).

Clearly each web application is it's own project but where do I put the shared components? Should each component be in it's own project with separate builds and work items?

Is there a best practice or recommended way to do this specific to TFS 2010?

A: 

I have two answers: what we do and what I suggest for you.

For us, we have a suite of web apps that all have MANY shared components. As such, although this is about 50 different assemblies (VS Projects) and 5-10 solutions (depending on how you look at it), there is very significant overlap across all of them which means we want to use TFS per-dev merging rather than branching and merging those overlapped resources. As such, we actually keep all of this in a single TFS Project. Here is how we have ours setup (names changed to make sense to you):

"Official Projects" (Collection)
    "Production Applications" (Project)
    "Technology Proof of Concepts" (Project)
    "Reference Projects" (Project) - this is a simple solution/projects using our architecture to make our architecture easier to understand as people join our team. Other reference apps will go here in the future.
    "TFS Configuration" (Project)
"Playground" (Collection)
    "John Doe" (Project)
    "Jane Doe" (Project)
    "Security Team" (Project)
    "Production Test" (Project)

In our setup, we have a place for official company code. In addition, we have an area for people to go goof off without having fear of messing anything up yet while being able to take advantage of various TFS-related benefits.

However, in your scenario, if I'm reading between the lines correctly, I would suggest something different. My assumptions:

  1. Each project, aside from having some common assemblies (I'm thinking logging, security, and other utility assemblies that are shared company-wide), are unrelated projects.
  2. The shared/common assemblies are not regularly being changed so you can use DLL references rather than project references where you are always using the latest up-to-the-minute/day version of the code.
  3. (TFS-based assumption as I'm still learning too) You can branch across Projects from the same Collection but you cannot branch across Collections.
  4. Other than the above-mentioned shared assemblies, no other code is shared across teams.

So with these assumptions, I would go with something like this:

"Common Resources" (Collection)
    "Source" (Project) - everything goes here such as logging assemblies, security assemblies, etc.
    "Version 1" (Project) - Branch as you "rev" your common assemblies so people have access to older versions.
    "Version 2" (Project)
    "Version 3" (Project"
    etc.
"Team 1" (Collection)
    "Project 1"
    "Project 2"
    "Project 3"
    "Project 4"
    "Project 5"
"Team 2" (Collection)
    "Project 1"
    "Project 2"
    "Project 3"
"Team 3" (Collection)
    "Project 1"
    "Project 2"
etc.

Doing it this way, you refer to the common assemblies via DLL references. You as the team or dev on a specific project get to decide when you begin to use a newer version of a common assembly. To do this, you simply get latest on that version's branch and then add a reference to it. If my assumption #3 is wrong, then hopefully you can do something better than that. Otherwise, each project has it's own space (that can contain more than just one VS Solution/Project which is a good idea) and your team has it's own collection to stay apart from the other teams.

Just my $0.02 worth...

Jaxidian
You are correct that you can't branch across collections
MrHinsh
I do not like your last comment on getting latest on the version branch and adding a reference to that. this will cause problems when you go to use an automated buid and it will not be able to resolve. It would be better to add a Tools folder in yoru Solution folder and have your shared resources in there. This prevents referenceing problems later down the line and removed the need to branch yoru common resources.
MrHinsh
I do however like your Team Collections :) but what happens when Team 1 desides that it has too much on its plate and wants to hand off Project 2 to team 3?
MrHinsh
Regarding the reference comment, that is something that will be a problem if your build automation doesn't handle this. If you have something this complex setup, then I'd imagine you can tweak your build automation to compensate. We do far more complex things than that with our build scripts.
Jaxidian
Regarding handing projects from Team 2 to Team 3, I have not yet handled this situation but my "on the back burner plan" is to use the migration tools to migrate that from one team to the other, perhaps with some massaging (for example, if it must copy everything in the project and I go back and delete the un-related items). It's a non-ideal solution but it's good enough and not a situation we will encounter much.
Jaxidian
+2  A: 

The best practice for this is to have everything that you need to build a solution under your Main/Trunk folder. We use the following format:

 "Project 1"
   "DEV" (Folder)
      "Feature 1" (branch
      "Main" (Root branch)
   "Release" (Folder)
      "Release 1" (branch)
   "RTM" (Folder)
      "Release 1.0" (Branch)
      "Release 1.1" (Branch)

This keeps all of your branches at the same level so you do not have any dout as to which is a branch and which is a folder.

Thats your Team Project structure, but what about the actual folder structure under each of the branches:

Main (Root branch)
  "Builds" (Folder that contains all of the MSBuild and Workflows for building)
  "Documents" (Folder that contains version specific documents)
  "Deployment" (Folder that contains config required for deployment | We use TFS Deployer from Codeplex)
  "Setup" (Folder contains all of the setup resources)
  "[Company].[Namespace].*" (Folders that contains a project)
  "Tools" ( Folder for all your nuts and bolts)
     "Toolname" (Folder for a specific tool or reference libruary)

The Idea is that it is the teams choice wither to use a new version of an external product or reference libruary. Just because one team can upgrade to a new version of NUnit does not mean that another team chooses not to as it is weeks of work.

By All means have a central "Tools" project that you always update with the latest and you team puls from there, but do not have external dependancies. It makes it a nightmare to do automated builds and makes your developers upgrade even if it is not a good time. On top of that make sure you treat any external dependancy as a Tool even if it is from another internal team.

MrHinsh
A: 

Use Workspaces, they not only work across Team Collections but will work with most versioning techniques.

Mike