A TFS 2010 check-in policy that checks for compilation warnings and errors. You can optionally restrict the set of warnings to Code Contract warnings only, if desired.
Check for Compilation Warnings and Errors Check-in Policy
This is a custom check-in policy that, when added to a Team Project, will check for compilation warnings and/or errors before allowing code to be checked in. You can optionally restrict the set of warnings to Code Contract warnings only, if desired.
Usage:
To add this check-in policy to your Team Project:
Download and install the Check for Compilation Warnings and Errors Check-in Policy. NOTE: Anyone checking in code will need to install the check-in policy on their local development workstations.
Within the Team Explorer in Visual Studio 2010, right-click on the desired Team Project and selectTeam Project Settings->Source Control.
Click on theCheck-in Policy tab, select Check for Compilation Warnings and Error Policy and clickOK.
Click on theEdit button and select the level of Warnings and/or Errors to check for. If you selectWarnings, you can optionally restrict the set of warnings to Code Contract warnings only by checking theCode Contract Warnings Only checkbox.
ClickOK and OK to close the dialog windows.
Once installed and configured, the check-in policy works like any other. You can check thePending Changes window for violations as seen in this screen shot:
Compatibility:
This version of the Check for Compilation Warnings and Errors Check-in Policy supportsVisual Studio 2010 and Team Foundation Server 2010. The Visual Studio 2008 version is availablehere.