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).
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:
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.