Code Analysis Check-in Policies

Check-in policy can be used to control and improve the quality of code that is checked into the code base.

Important

To use check-in policies, you must be connected to Team Foundation Server.

The check-in policy fails in the following cases:

  • Build not up to date

    This occurs when the developer modifies code and tries to check in the change without doing a rebuild of the project. To correct this, rebuild the modified project to make sure that it passes the code analysis policy set by the project lead.

  • Errors in the last build

    The check-in policy fails because there were errors in the last build. To correct this, the developer must correct the errors; rebuild the solution to make sure that the code is passing the check-in policy before checking in the changes.

  • Incorrect rules selected

    The policy fails because the rule set was incorrectly. To correct this, the developer must synchronize the check-in policy from the server to the projects in the active solution. For more information, see How to: Migrate Code Analysis Check-in Policy.

  • Command line check-in

    Check-in policy is not supported from the command-line.

  • Visual Studio solution is not open

    Check-in fails if you try to check in files that are part of a solution, but the solution is not currently open.

  • Files open in a solution are not part of the solution

    It is possible for the project lead to set the option of failing the policy if not all the files to be checked in are part of the currently open solution.

The check-in policy passes if:

  • Build up to date. No code analysis errors

    The check-in policy passes because the build is up to date and there are no code analysis errors. In addition, the rules enabled in the project are at least as restrictive as the rules that are defined in the check-in policy.

In This Section

How to: Add Check-in Policies

Describes how to create custom check-in policies associated with Team Foundation source control check-ins.

How to: Edit Check-in Policies

Explains the procedures that are used to modify a check-in policy.

How to: Migrate Code Analysis Check-in Policy

Explains the procedure that is used to migrate code analysis policy from the server to the client.

How to: Remove Check-in Policies

Describes the steps that are required to delete a check-in policy.

How to: Enable and Disable Check-in Policies

Explains the steps that are used to either enable or disable an existing check-in policy.

How to: Configure Check-in Notes

Describes the steps that are used to configure custom check-in notes associated with Team Foundation source control check-ins.

How to: Connect to Team Foundation Server