Creating and Using Code Analysis Check-In Policies

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

When you use Team Foundation Version Control (TFVC), 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

Important

Code analysis check-in policies cannot be applied to web site projects. They can be applied to web application projects.

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

How to: Create or Update Standard Code Analysis Check-in Policies Explains the steps that you use to set and modify a code analysis policy for a team project.

Implementing Custom Check-in Policies for Managed Code Explains the steps that you use to create a custom rule set for the check-in policy of a team project, and to synchronize the code projects of the team project with the check-in policy.

Version Compatibility for Code Analysis Check-In Policies Explains code analysis check-in compatibility issues between versions of Visual Studio Application Lifecycle Management (ALM).

How to: Customize the Code Analysis Dictionary Explains how to add words and tokens to the dictionary that is referenced in code analysis naming rules.

Set and Enforce Quality Gates

Enhancing Code Quality with Team Project Check-in Policies