Share via


Edit check-in policies

TFS 2017 | TFS 2015 | TFS 2013

Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | Visual Studio 2013

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 Develop code and manage 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.
  • 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.

Prerequisites

To complete this procedure, you must have the Edit project-level information permission set to Allow. For more information, see Default TFVC permissions.

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.

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

  5. Click OK.