Keeping Version Control Labels When Team Builds Are Deleted in TFS 2008 SP1

We have had quite a few complaints about the fact that we delete the labels created during a build when the build is deleted. The reason this behavior was added was to keep from creating a ton of labels for CI builds. But some customers still want the labels to exist after the build has been deleted. Long term we will allow you to choose what gets deleted with the build. But for now, we have made a change that is available in Team Foundation Server 2008 SP1 that you should like.

If you want to always keep labels even though builds are being deleted by retention policies or manually, you can simply make a change on the Application Tier in the web.config file. Here are the details:

1) Locate the Team Foundation Web.Config file on the Application Tier.

2) Add a flag to the Web.config file to specify that labels should not be deleted. When this value is present, labels are not deleted from Source Control. The default behavior is still the same as RTM; labels get deleted with their corresponding builds. Here is an example of what that line in the web.config file would look like:
<add key="PreserveLabelsOnBuildDeletion" value="True"/>

3) Run IISReset to force the changes to be used.

I hope this helps those customers that use labels a lot.