Registering custom checkin policy for Certain user

2019-06-08 05:37发布

问题:

I have created custom checkin policy for TFS. It is deployed to the client system. I have added the custom checkin policy for project collection in TFS. But I have a number of clients that have not installed the custom checkin policy, when these developers want to check in, Visual Studio shows an error

Internal error in Check for PMS Details. Error loading the Check for PMS Details ...

So I want to apply the custom checkin policy for certain users. For example the user is admin then no need to run the custom checkin policy.

回答1:

As others mention, the policy needs to be installed on the Client machine to work. There is no getting around that. You can, however, in the policy itself check the Identity and group membership of the user doing the check-in and skip the policy validation (always return an empty array of PolicyFailures) in that case.

I have been working on such a policy, but never found time to finish it. The policy I have been building works in the same way as the ConditionalPath policy that ships in the TFS Power tools. Basically it wraps another (set of) rules and places a condition on their execution.



回答2:

Custom policies need to be installed onto the client system, they are not centrally processed.

A check in policy can be scoped only to the project level within TFS, as far as I am aware you are unable to limit a policy in any other way unless you handle this within the policy itself.



回答3:

You must install your check-in policies on all TFS Windows clients, otherwise you get the nasty error.

A conditional policy can be implemented in two ways.

  1. set the condition inside the custom policy code
  2. use a Gated check-in build and customize the Build template

There is a third option, a Server side event handler, but I generally discourage it.



标签: tfs tfvc