TFS & Visual Studio ALM – by Neno Loje

(formerly Team System, VSTS)

Turning off policy overrides in TFS

May 13th, 2014 · 4 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 2018 here (for TFS 2017 here, for TFS 2015.1 or higher, you can find it here and for TFS 2013, here).
  • To uninstall, just remove the .DLL from the “PlugIns” folder.

A word of warning

Disclaimer:
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 Team Services).

Enjoy!

–Neno

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

Update (June 6, 2017): Added link to TFS 2017-compatbile .ZIP file and changed “Visual Studio Online” to “Visual Studio Team System”.

Update (July 19, 2018): Added download link to TFS 2018-compatbile version, and fixed the link for the TFS 2017 version.

Tags:

4 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?

    –Neno

  • Coder

    Not working for TFS 2015.

    I have followed the steps mentioned in “How to set it up” section. Still when i try to check in with Override warnings, it is allowing to check in.
    My version of TFS is 2015

    Any thing that i am missing>

    • vstsblog

      Coder,
      Are you running at least 2015 with Update 1 installed?
      If so, feel free to use the contact form and I will help you investigate.
      –Neno

Leave a Comment