Walkthrough: Customizing Check-In Policies and Notes

You can use Team Foundation to define your own fields for a team's check-in notes and to define custom check-in rules to enforce restrictions for the types of changes that can be committed to the source control server.

  • Creating Check-in Note Templates and Requirements

    You can define your own fields for collecting check-in related information and that require information be specified by users during the check-in process. This information is persisted with other changeset details and can be included in the e-mail notification that is delivered to other team members.

  • Defining Check-in Policies

    You can define custom check-in rules to enforce restrictions for the types of changes that can be committed to the version control server. For example, a project administrator can define rules to validate source changes before committing them to the server. Team Foundation includes check-in policies for validating that work items are associated with changes, unit tests pass successfully, and static analysis has run cleanly on source code. These policies are extensible by way of a plug-in model so that you can enforce requirements of a different kind just by creating a new policy plug-in.

This walkthrough describes how to add check-in notes and how to define a check-in policy that requires work items be associated with every check-in.

Required Permissions

To complete this walkthrough, you must have the Check out and Edit server-level information permissions set to Allow. For more information, see Team Foundation Server Permissions.

Creating Check-in Notes

You can define your own fields for a team's check-in notes and establish user requirements for the check-in process at the level of root folders in the server (for example, $/folder1). These folders correspond to your team projects. Those settings then apply to all source that is contained under those folders. When users try to check in revisions to a server folder for which custom check-in notes or requirements are defined, they are prompted to complete the notes in the Check In dialog box or Check In window. Check-in notes can be optional or required.

To add and configure a check-in note

  1. In Team Explorer, right-click a team project, click Team Project Settings, and then click Source Control.

  2. Click the Check-in Notes tab and then click Add.

  3. In the drop-down list for Name, type the name that you want to use for the new check-in note.

  4. Optionally, select Required on check-ins and then click Add (this makes adding text for this check-in note mandatory during the check-in process).

  5. Optionally, change the order of the check-in notes by selecting a check-in note and using the arrow buttons to move its placement order.

  6. When you are satisfied with the settings for the check-in notes, click OK.

Configuring Pre-defined Check-in Policies

To customize check-ins, you can configure pre-defined check-in policies that evaluate compliance of changes with organizational standards.

To configure a pre-defined check-in policy

  1. In Team Explorer, right-click your team project, click Team Project Settings, and then click Source Control.

  2. Click the Check-in Policy tab and then click Add.

  3. In the list under Check-in Policy, select the desired policy type; Builds, Code Analysis, Testing Policy, or Work Items, and then click OK.

    • If you selected Builds, the policy is added to the list. This policy requires that a previous build was successful before any new changes can be checked in.

    • If you selected Code Analysis, the Code Analysis Policy Editor dialog box appears. Select the check boxes for the types of code analysis that you want performed. The options are Enforce check-in to only contain files that are part of current solution, Enforce C/C++ Code Analysis (/analyze), and Enforce Code Analysis For Managed Code. If you select Enforce Code Analysis For Managed Code, select the desired rule settings in the Rule settings for Managed Code Analysis window. Click OK. For more information about how to use code analysis tools, see Guidelines for Using Code Analysis Tools.

    • If you selected Testing Policy, the Testing Policy dialog box appears. Click Browse to specify a metadata file, select the test desired, and then click OK.

    • If you selected Work Items, the policy is added to the list requiring that one or more work items be associated with every check-in.

  4. When you are satisfied with the settings for the check-in policies, click OK.

See Also

Tasks

Walkthrough: Exploring Team Foundation Version Control

How to: Find a Changeset

Reference

Add Command

Other Resources

Team Foundation Version Control Walkthroughs