1
votes

I'm trying to create a custom pre-checkin policy in TFS. I was able to create it according to my needs. Now I have a problem. I'm required to have that policy executed on selected computers that are client to that TFS collection.

Whenever I add the custom policy to the collection, it is applied for every computer that is client to that collection - irrespective of the fact whether the custom policy is registered on the client computers or not. For those computers that do not have the policy DLLs registered, their check-in fails no matter what.

My question is, how can I have my policy enabled on my TFS collection and have it run on selected TFS clients?

2
Hi Shibal, any update on this case, just checking to see if the information provided was helpful.PatrickLu-MSFT

2 Answers

0
votes

You can't. If you have a check-in policy, that policy is applied to all check-ins that occur via Visual Studio, regardless of user. There is no way to change this behavior. This is one of many reasons why you should not rely on custom check-in policies.

Git has support for much more robust branch policies, and Git has been where Microsoft has been investing their effort for the past several years, as Git has (like it or not) become the industry standard for source control.

0
votes

Check-in policies are a set of rules (each policy as a single rule) that must be followed whenever a developer wants to check-in changes to a repository.

Each policy that is previously set for the specific Team Foundation Server project requires a developer to take specific action prior to checking in changes.

Unlike some other requirements such as a gated check-in, it's also not able to directly bypass for some users.

As any alternative way to achieve this, you could refer solutions in this similar question: Restricting TFS check-in policy to specific users

Custom policy implementation. It allows to run child policy if user does not have certain permissions (is not member of certain group).

It can be used with custom path policy from TFS power pack and ColinsALMCornerCheckinPolicies Then it will be possible to ask for code review only for certain projects|files|folders and only if user has no permission to check-in without code review.

You need to create customize check in policy and child policy, inspect the Custom path Policy to make it work.