views:

78

answers:

1

Our .NET team works on projects for our company that fall into distinct categories. Some are internal web apps, some are external (publicly facing) web apps, we also have internal Windows applications for our corporate office users, and Windows Forms apps for our retail locations (stores). Of course, because we hate code reuse, we have a ton of code that is shared among the different applications. Currently we're using SVN as our source control, and we've got our repository laid out like this:

 - = folder, | = Visual Studio Solution
-SVN
   - Internet
      | Ourcompany.com
      | Oursecondcompany.com
   - Intranet
      | UniformOrdering website
      | MessageCenter website
   - Shared
      | ErrorLoggingModule
      | RegularExpressionGenerator
      | Anti-Xss
      | OrgChartModule etc...

So..

The OurCompany.com solution in the Internet folder would have a website project, and it would also include the ErrorLoggingModule, RegularExpressionGenerator, and Anti-Xss projects from the shared directory.

Similarly, our UniformOrdering website solution would have each of these projects included in the solution as well.

We prefer to have a project reference to a .dll reference because, first of all, if we need to add or fix a function in the ErrorLoggingModule while working on the OurCompany.com website, it's right there. Also, this allows us to build each solution and see if changes to shared code break any other applications. This should work well on a build server as well if I'm correct.

In SVN, there is no problem with this. SVN and Visual Studio aren't tied together in the way TFS's source control is. We never figured out how to work this type of structure in TFS when we were using it, because in TFS, the TFS project was always tied to a Visual Studio Solution. The Source Code repository was a child of the TFS Project, so if we wanted to do this, we had to duplicate the Shared code in each TFS project's source code repository. As my co-worker put it, this "breaks every known best practice about code reuse and simplicity". It was enough of a deal breaker for us that we switched to SVN.

Now, however, we're faced with truly fixing our development processes, and the Application Lifecycle Management of TFS is pretty close to exactly what we want, and how we want to work. Our one sticking point is the shared code issue.

We're evaluating other commercial and open source solutions, but since we're already paying for TFS with our MSDN Subscriptions, and TFS is pretty much exactly what we want, we'd REALLY like to find a way around this issue.

Has anybody else faced this and come up with a solution?

If you've seen an article or posting on this that you can share with me, that would help as well.

As always, I'm open to answers like "You're looking at it all wrong, bonehead, HERE'S the way it SHOULD be done.

+1  A: 

I think there's some misunderstandings here. First, you can have multiple (as many as you want) solutions in a single TFS project. Also, a single Visual Studio project can have any number of solutions referring to it.

Second, what version of TFS are you using? 2010 is different from 2005/08 in how it handles TFS projects.

Under 2008, there are several ways to approach this depending on what you want to get out of it. You can either have multiple TFS projects or a single TFS project.

I'll start with multiple.

Set up a TFS project for your shared library type code, and others for each regular project you have. As part of the development process on this shared library, check in the completed assemblies. Then Branch those assemblies into any other TFS project you want to use them in. When you do a feature update or bug fix to the shared library, simply merge the branch into any other TFS project you want the updates to go into.

This allows you to make shared changes for a single app without having to push all of them.

If you want a single TFS project holding everything, just add folders for each Visual Studio project you want. The visual studio solutions can refer back to projects outside of their base tree without issue. Now, when configuring things like Builds for each solution, make sure you limit what directory the build server pulls from / watches. That way you don't have it building one of your internal sites when changes were made to an external site.

Chris Lively
Thank you for taking the time to read this and answer. When we had the issue originally, we were using the 2005 version. Can you point me, by any chance, to documentation on how VS2010 is different than 2005/2008? We would be using 2010 if we switch back to TFS.I'm going to set up a virtual environment and try out the two approaches you mentioned. It looks good, so +1, and if we use it(or if I get no better answers) I'll accept your answer as well.
David Stratton
2010 took a different approach to team projects. They have a new thing called "Project Collections" which would be exactly what you want. Information is here: http://msdn.microsoft.com/en-us/library/dd236915.aspx
Chris Lively
@Chris Lively - Again, thank you. Sorry it took so long, but it took me a while to get my environment set up. I'm accepting your answer mostly based on this last note as it IS exactly what I wanted, but your original answer was good, too. I appreciate you taking the time.
David Stratton