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

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:


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



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.




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.



That’s all there is to this.