category: [ VSTS / TFS ] tags: [ Check-In Policies ] [ GitHub Projects ] [ TFS Server Plugins ]
created: 10 Jan 2014 @ 08:19 modified: 24 Apr 2017 @ 13:57
So one of the benefits of using Server side Plugins is that you can't override them. The problem with this is that the users don't know that the policy is in place until they check-in their code. Wouldn't it be nice if me as a user were told this is what I need to do as in see the requirements from check-in policies but then to make the administrators or business rules that require the policies to also be happy.
One way that you could probably achieve this is to create a check-in policy and then create a server plugin with the same logic, this seems like double work and implementing this for each policy will become annoying. What about the policies that you get from Visual Studio Gallery like the one from Colin Dembovsky called Colin's ALM Checkin Policies for VS 2013, you'd have to request the source code and then each time there is an update you'd have to update your code.
A much easier way is to create one simple server plugin that will enforce that any check-in policies are met. To achieve this you can use the source code below as a server plugin
This code sample at the moment will work against any Team Project in the instance you deploy it to. You can add code in if you need it to only work against certain collections or projects.
Basically what will happen now is you will get an error when not doing what is required by the check-in policy and then will have to override it
Except when you click check In you get another unexpected message
You'll never have to worry about policies being overridden again. Obviously this doesn't allow for the occasions where you would want to allow for overriding but you can build logic in that would then accept the override in certain situations.
You can get the code from GitHub using the url https://github.com/Gordon-Beeming/TFS.ServerPlugins.
Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.