A couple of years ago we moved from Subversion and Cruise Control.NET to Microsoft's TFS (Team Foundation Server) as our core platform for software development. We started with TFS 2005, and soon moved to TFS 2008; needless to say, we anxiously await all of the improvements coming in TFS 2010 — check out Brian Harry's post for a nice summary.

This post focuses on your TFS Team Build labels disappearing...

One of the nice default behaviours of the Team Build process is it labels your repository. This gives you the traceability between your build artifacts at the state of the repository that was used to create them. However, as your builds accumulate, you will probably set a retention policy that removes older builds from your server. We found out (the hard way) that the default behaviour of TFS is to not only delete the build report and artifacts, but it also deletes the Label it created on your repository.

With SP1, you have the ability to change this behaviour — but it is applied across your entire TFS server (it can't be modified per Team Project ). To make this change, you just have to add the following to the appSettings section in the web.config file on your TFS app-tier server:

  <add key="PreserveLabelsOnBuildDeletion" value="true" />