Поделиться через


Edit Check-In Policies

Administrators of Team Foundation version control can add and edit check-in policy requirements. These check-in policies require the user to take actions when they conduct a check-in to version control; for example a user can be required to associate a work item with a changeset. For more information on check-ins, see Check In Pending Changes. Before editing a check-in policy, you must first create one. For more information, see Add Check-In Policies. The default available check-in policy types include:

  • Builds   Requires that the last build was successful before a check-in.

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

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

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

Note

You can temporarily disable one or more policy types in Source Control Settings, on the Check-in Policy tab, by highlighting the policies and clicking Disable. To enable a disabled policy, highlight the disabled policy, and click Enable.

Required Permissions

To complete this procedure, you must have the Edit project-level information permission set to Allow. For more information, see Team Foundation Server Permissions.

To edit a check-in policy

  1. On the Team menu, click Team Project Settings, and then click Source Control.

  2. In the Source Control Settings dialog box, click the Check-in Policy tab.

  3. In the policy type list, click the policy type for which you want to make changes, and then click Edit.

  4. Continue this procedure based on the type of policy you are editing:

    • Builds   Requires that the last build was successful before a check-in. This policy type cannot be modified.

    • Code Analysis   Requires that code analysis be run before code is checked in. The Code Analysis Policy Editor appears.

      Click the check 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 the Enforce Code Analysis For Managed Code check box, select the desired rule settings under Rule settings for Managed Code Analysis.

      For more information about how to use code analysis tools, see Creating and Using Code Analysis Check-In Policies.

    • Test Policy   Requires that certain tests are run before code can be checked in. Clicking OK displays the Testing Policy dialog box, which prompts you to specify a Metadata file by clicking the ellipses () and then the test list that you want.

      (Optional) Select the Apply check-in policy only to tests impacted by code changes check box if you want to restrict the policy on this criterion.

      For more information, see Create Test Settings to Run Automated Tests from Visual Studio and Defining Test Lists to Group Your Tests.

    • Work Items   Requires that one or more work items be associated with the check-in. This policy type cannot be modified.

  5. Click OK.

See Also

Concepts

Set and Enforce Quality Gates

Working with Changesets

Other Resources

Walkthrough: Customizing Checkin Policies and Notes