TFS 2010 : How to apply check-in policies to only certain branches or folders

TFS 2010 : How to apply check-in policies to only certain branches or folders

  • Comments 3

This question keeps coming up frequently, and so I thought to make a succinct post on how to do this.

 

First install the TFS 2010 Power Tools by downloading it to your Client box. You can do a bing search to locate the “TFS 2010 Power Tools download”. This has to be installed on each Client box on which Visual Studio 2010 is installed.

Then go to Source Control as shown below:

image

Once you installed the Power Tools, you should see a new set of Check-in policies in place as shown below.

SNAGHTML830358b

 

Note that it says that “This policy scopes other policies to specific folders or file types, and there you have it. So what it means is essentially you could create some other policy and use that as a child to this policy and then constrain it to be triggered for checking only if the check-in happens to go under the folder or branch that you specify in its scope.

 

clip_image004

 

To further illustrate this:

Below I have created a “Code Analysis” policy, and then used it as a Child policy for the “Custom Path policy” and scoped it to apply to the “DEV” branch. You can just enter a matching string for regexing into the particular branch you want to.

If this is not what you are seeking, then you might also consider writing a custom check in policy. Note that policies are evaluated at the client prior to checkin.

clip_image002

 

That’s all there is to this.

Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post
  • How do you know which Custom Path Policy applies which Checkin policies?

    We have 56 branches and I can't figure out which check-in policies apply to which branch. Ideas?

  • As a wise man (Dean Varillas @ cartwheels) once said, 56 branches is up to no good, just like Engelwood if you know what I mean.

  • It would work better with a regex; of .*DevProject/DEV.*  This is case sensitive.  Also note that the Child policy must have been previously added, and all machines performing a checkin will need the power tools installed.  The policy takes effect immediately, no restart of Visual Studio needed. Be sure to disable the child policy.

Page 1 of 1 (3 items)