Andrew Hall wrote a great post on the Code Analysis Team Blog about how to use the code analysis checkin policy with gated checkin in Team Foundation 2010 Build to reject checkins that have code analysis warnings or errors.  He shows you how to configure the rule set and set up the gated build definition to enforce the code analysis rules you’ve chosen.

Preventing check-ins to TFS that contain code analysis warnings

Recently we have received several questions regarding Visual Studio Code Analysis integration with Team Foundation Server’s check-in policy and build server, so I thought it would be helpful to clarify the behavior and expose some relatively hidden functionality.

more…

Enjoy!