TFS & Visual Studio ALM – by Neno Loje

(formerly Team System, VSTS)

Turning off policy overrides in TFS

May 13th, 2014 · 2 Comments · 18401, Team Foundation Server, Team Foundation Version Control, Tools and Utilities

The Goal

Check-In policies have been around since the first version, TFS 2005, to help a team define a list of steps they want to perform prior the checking in. If a policy is not met, it alerts the user.

When policies fail, there is an option to “override” the warning(s) and continue with the check-in (the policy warnings will still be stored as part of the changeset).

Figure 6.6 CheckIn Policy Violations

While it’s easy to set up an alert to get notified when this happens, or query the TFS Warehouse to get a list of all overrides, there’s no built-in way to turn off overrides entirely.

The Solution

A server-side plug-in that intercepts all check-ins and rejects the changeset if it is a policy override. After activating the plug-in (which is simply a drag & drop of the plug-in .DLL into a specific folder on the TFS Application Tier), this is what happens if users try to override:

No Policy Overrides

How to set it up

  • To install, copy TFS.VersionControl.NoPolicyOverrides.dll to the “PlugIns” folder, located at: %ProgramFiles%\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\bin\Plugins
  • Download the .ZIP package with all event-handlers for TFS 2015.1 or higher here (for TFS 2013, you can find it here).
  • To uninstall, just remove the .DLL from the “PlugIns” folder.

A word of warning

Server-side event handlers must be very well written. As they run inside of the TFS process itself, they can crash TFS, significantly degrade performance or change the behavior of built-in operations (e.g. a badly written plug-in could cause new team project creation to fail).

Note: Server-side plug-ins work on TFS on-premises only (not with Visual Studio Online).



Update (February 23, 2016): Added link to TFS 2015.1-compatible .ZIP file.


2 Comments so far ↓

  • Jesse Houwing

    Did you whitelist the “Builds” checkin policy? It would be very hard to get your build system unstuck if you’re using this policy combined with your plugin…

  • neno

    @Jesse: No, I haven’t. Right now the plug-in does exactly what it says: makes sure you cannot override anything.

    Would you like to use the Builds policy together with this?


Leave a Comment