Share via

Creating and Using Code Analysis Check-In Policies

When you use Visual Studio Premium, you can create a code analysis check-in policy for the .NET Framework and native (C/C++) code projects in a team project. You can use the code analysis check-in policy to control and improve the quality of code that is checked into the code base.

The policy passes when the local build is up to date and code analysis has been run on the most recent source files. At a minimum, the code analysis rules that are enabled in the code project must contain the same rules as those that are defined in the team project check-in policy. Rules that have been specified as errors in the Team Project Settings must also be specified as errors in the code project


To use check-in policies, you must be connected to Visual Studio Team Foundation Server.

You create code analysis check-in policies by using the Team Project Settings of Team Foundation version control. Check-in policies are specified and enforced for a team project, but code analysis runs are configured and run for individual code projects on local development computers. This section describes how to specify code analysis check-in policies for a team project and how to implement custom code analysis policies for managed code.

In This Section

Set and Enforce Quality Gates

Enhancing Code Quality with Team Project Check-in Policies