Click here to Skip to main content
Click here to Skip to main content

Enforce Check-in Policy in TFS 2008

, 24 Aug 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Enforcing Check-in Policy on Team Foundation Server 2008


Microsoft Visual Studio Team System 2008 is an integrated application lifecycle management (ALM) product family with the tools and processes that help development teams work more effectively together.

Microsoft Visual Studio Team System 2008 Team Foundation Server (TFS) is a team collaboration platform that combines team portal, version control, work-item tracking, build management, process guidance and business intelligence into a unified server. It allows everyone on the team to collaborate more effectively and deliver better-quality software.

Version Control is one of the key elements of Team Foundation Server apart from Work Item Tracking, Project Management, Build Automation and Reporting. In TFS, we can enforce Check-in policies on projects. A Check-in policy is a requirement for developers to perform one or more tasks on code before it is allowed to be checked into the version control system.
Policies can be enforced such that work items are associated with the check in or unit tests are being run or that code analysis is performed before check-in.

In this article, let me show how to enforce check-in policies on Team Projects in TFS 2008 in a step by step manner.


Open Team Explorer and connect to the Project.
Right click on the project --> Team Project Settings --> Click on Source Control.
Refer to the screenshot below:

p1.jpg - Click to enlarge image

The Source Control Settings window opens up.
You can allow multiple check-outs in the first tab “Check-out Settings”, to allow parallel development.

Then click on the tab “Check-in Policy” to set the check-in policy on the project.

p2.jpg - Click to enlarge image

In the “Check-in Policy tab”, click on “Add” button to add the relevant check-in policies as per the project requirement. Select the Policy from the list of available policies and click the “OK” button.

p3.jpg - Click to enlarge image

Here, I have selected Code Analysis policy. Once Code Analysis policy is selected, it would ask to select the Rule sets for Code Analysis. Select the relevant rules for your project’s code analysis and click on “OK” button. Refer to the screenshot below:

p4.jpg - Click to enlarge image

Then, I selected the “Work Items” policy, such that the developer or any team member needs to associate a work item with the check-in. Work Items are the fundamental way of allocating task to team members in TFS. For example, the Project Manager can allocate a task like “Add Login Screen” through Work Items in TFS. So once the developer completes the task, while checking in, the developer can link the Work Item “Add Login Screen” with the relevant check-in.

p5.jpg - Click to enlarge image

Once all the policies are defined, click on “OK” button in the Source Control Settings window.

Now, add the Project / Solution to the TFS Project Source Control.

Then in the development environment, if the User tries to check-in any file(s), she/he will get the “Check-In – Source Files” window. Refer to the screenshot below. This window lists the collection of files being checked in. User can put in comments, check-in notes and associate Work Items with the check-in. With every Check-In on TFS, a Changeset is created on the server with a unique numeric ID. So a Changeset is a collection of check-in files along with work items and other relevant information.

p6.jpg - Click to enlarge image

Next, once any user tries to check-in any file(s), without fulfilling the requirements defined in the check-in policy for the project, she will get a Policy Failure warning. Refer to the screenshot below:

p7.jpg - Click to enlarge image

However, there are many occasions where we need to check-out for certain purposes where policy binding does not make any sense. TFS allows the user to override check-in policy with a reason. Refer to the screenshot below. But this should not be a prelude to override policy as the Project Manager can review the check-in logs and policy violations to detect the users who are not following the standard check-in policy.

p8.jpg - Click to enlarge image

To map with Work Items, any user can click on the Work Items button available in the “Check-In – Source Files” window. A user can select one or more work items by clicking the checkboxes available with the Work Items and then click on “Check-In” button. Refer to the screenshot below:

p9.jpg - Click to enlarge image

If the check-in policies are followed, the system should allow check-in to the server without any further warning.


In this article, we learnt about Check-in policies in TFS and how to enforce and follow the same. You can learn more about the TFS version control features from my article Version Control in VSTS 2008.

To learn more about the features of VSTS and TFS, please refer to this URL.


  • 24th August, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Other Brilliance Information Sdn Bhd
Malaysia Malaysia
Working as a Senior Consultant with Brilliance MSC, Malaysia.
Love to evaluate new technologies and implement the same.
Believe in sharing knowledge.

Comments and Discussions

GeneralMy vote of 5 PinmemberAndyInPembs1-Feb-12 4:14 
Exactly what I needed...
GeneralGood Article Pinmemberjohnclark6426-Aug-09 21:00 
GeneralRe: Good Article PinmemberRobin_Roy26-Aug-09 21:19 
GeneralAwesome Pinmemberalbert_cook26-Aug-09 17:35 
GeneralRe: Awesome PinmemberRobin_Roy6-Sep-09 18:04 
GeneralWonderful! PinmemberAnt210025-Aug-09 0:44 
GeneralRe: Wonderful! PinmemberRobin_Roy25-Aug-09 17:29 
GeneralGood Article Pinmemberarvindjo24-Aug-09 22:44 
GeneralRe: Good Article PinmemberRobin_Roy25-Aug-09 17:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 25 Aug 2009
Article Copyright 2009 by Robin_Roy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid