How to: Add Check-in Policies
The document is archived and information here might be outdated

How to: Add Check-in Policies

Administrators of Team Foundation source control can add check-in policy requirements. These check-in policies require the user to take actions when they conduct a check-in to source control, for example a user can be required to associate a work item with a changeset. For more information about check-ins, see How to: Check In Pending Changes. The available default check-in policy types include the following:

  • 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.

Required Permissions

To complete this procedure, you must have the Manipulate security settings permission set to Allow. For more information, see Team Foundation Server Permissions.


To create a check-in policy

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

    The Source Control Settings dialog box appears.

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

    The Add Check-in Policy dialog box appears.

  3. In the Check-in Policy list, select the policy type you want and then click OK.

    The list includes the following selections.

    • If you selected Code Analysis, the Code Analysis Policy Editor dialog box appears. Click the boxes for the types of code analysis that you want performed. 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 that a work item must be associated with the check in.

  4. When you are satisfied with the settings for the check-in policies, click OK; the new check-in policy now displays with future check-ins.

See Also

© 2016 Microsoft