This project has moved and is read-only. For the latest updates, please go here.

Sharing a folder of common files between projects

Jan 21, 2010 at 3:05 PM

I'm a little unsure of the best way of to share a folder of common files between projects.  These common files are typically 3rd party libraries or libraries released from sources outside of TFS.

To try and explain the situation a little better, I'll explain the setup and what I was trying to do.

First, I had a main project - "My Product" with two branches Main and Release.  We're a small comapny and there's no need for a Development branch yet, in the past we've just used labels in CVS to do releases and then branched from a label on the rare occasions we need to do a 'service pack' release.  Normally we ship bug fixes by providing the tip release.

I then created a new project "My Libraries" that contains some shared libraries I wanted to use.  I wanted these to be in their own project so that the libraries could be updated with new versions, but other projects that use the libraries could accept the updates as they see fit.

So that when you get "My Product", you get everything needed to build it I wanted to include the Libraries in there.  So I tried to branch "My Libraries" in to a sub folder of "My Product", but you can't appear to do this as it complains "My Product" is already a branch.  What I was tryng to do was like this:

"Libraries" Project -> "Libraries" Folder

"My Product" Project -> "Main" Branch -> "Src" Folder

                                                          -> "Libraries" Folder Branch*

                               -> "Release" Branch

* = this was where I was trying to create the branch

Eventually I managed to re-arrange things with the "Libraries" Folder Branch at the same level as the "Main" and "Release" branches:

"Libraries" Project -> "Libraries" Folder

"My Product" Project -> "Main" Branch

                               -> "Release" Branch

                               -> "Libraries" Folder Branch

But there's a couple of things I don't like about this.

First, I'd like a particular release to have a particular set of libraries.  So the plan was to update the Libraries, merge in to "My Product" Main as appropriate, test and then merge into the "Release" branch for a release.

Second, if I get the Main branch I don't get the Libraries automatically, and if I get the project as a whole the "Main" and "Release" branches end up sharing the same copy of "Libraries".

Any recommendations on how to do this kind of thing would be gratefully received.




Jan 21, 2010 at 3:51 PM


For shared libraries, I generally prefer using file references rather than project references. I would have a separate TeamProject for developing the source code for these libraries. You could deploy the assemblies to a shared folder and reference these assemblies from the various projects that use them. This approach would permit you to have multiple versions of the assemblies. Each project would create file references to the particular version they require.

Alternatively, you could create a libraries folder within your Main branch containing these assemblies. The correct version of the assemblies would be checked into source control as part of the same branch containing the libraries folder.

After releasing a version of "My Product", you could change the Main branch to reference a different version of these assemblies. Once the Release branch is created, we recommend never doing a subsequent merge from Main (FI) since that would "pollute" the Release branch with newer development that might be in Main. Subsequently, when you release a new verion of "My Product", you would create a new Release branch.

Bill Heys
VS Ranger

Jan 25, 2010 at 11:48 AM

Thanks for the info Bill. 

The shared folder approach is what we currently do, I was just wondering if we could do some kind of sharing using branching in TFS (I guess a bit like sharing a file and then pinning it in Source Safe). 

We'll try the TeamProject and shared folder approach for the moment.

Thanks for the advice on the Releases branch.  I was following the Basic Branch Plan for this, but will experiment a bit and see how it goes.

Thanks and Regards,



Jan 21, 2011 at 6:12 PM

Our team also have shared applications that are used in many different team projects.  When debugging an application or doing a step through we found that we could reference that application with the reference path,  this worked fine and we could step through programs for debugging. 

Where we ran into instances was this worked fine for using in the reference path but when we wanted to point to a different web application or use Type Web the Reference Path does not allow this only files.  We do not want to add anything to the actual references since some of the programs we want to walk through could be production applications (in Main) that we do not want to change.

Any suggestions on testing?