Enhancing Code Quality with Team Project Check-in Policies

When you use Visual Studio Premium, you can create check-in policies for your team projects. to enforce practices that lead to better code and more efficient group development. Check-in policies are rules that are set at the team project level and enforced on developer computers before code is allowed to be checked in.

There are four team project check-in policies that you can specify:

  • Builds Requires that build breaks that were created during a build must be fixed before a new check-in.

  • Code Analysis Requires that code analysis is run before check-in.

  • Testing Policy Requires that check-in tests are completed before check-in.

  • Work Items Requires that one or more work items be associated with the check- in.


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

Common Tasks


Supporting Content

Create and use check-in policies: You create check-in policies by using the Team Project Settings of Team Foundation version control.

Set and Enforce Quality Gates

Create and use code analysis check-in policies: You can choose from a standard set of code analysis rules, or you can create a custom set.

Creating and Using Code Analysis Check-In Policies


Supporting Content

Set up your development environment: Before you can create or modify code, you must set up your development and test environments by using the appropriate source code. If you are working with databases, you must also have access to their offline representation.

Setting Up Development Environments

Use Code Analysis in development process: Team members run code analysis on their development computers. In Visual Studio, developers configure and run code analysis runs for individual code projects, view and analyze issues found by the runs, and create work items for warnings.

Analyzing Application Quality by Using Code Analysis Tools

Create and run unit tests: Unit tests give developers and testers a quick way to look for logic errors in the methods of classes in C#, Visual Basic .NET, and C++ projects. A unit test can be created one time and run every time that source code is changed to make sure that no bugs are introduced.

Verifying Code by Using Unit Tests

Track work items and defects: You can use work items to track and manage both your work and information about your team project. A work item is a database record that Team Foundation uses to track the assignment and progress of work. You can use different types of work items to track different types of work, such as customer requirements, product bugs, and development tasks.

Track Work and Manage Workflow

External resources


Testing for Continuous Delivery with Visual Studio 2012 – Chapter 2: Unit Testing: Testing the Inside