This article demonstrate how to enable Source Code Check-in Policy inside TFS 2010.
Following are the default policies available with TFS:
Policy | Description |
Builds | This policy requires that the last build was successful for each affected continuous integration build definition. |
Code Analysis | This policy requires that Code Analysis is run before check-in. |
Testing Policy | Ensures that tests from specific test lists are successfully run before checking in. |
Work Items | This policy requires that one or more work items be associated with every check-in. |
Step 1) Install New Policy
We can try adding a new policy that ensures Comments are associated with public methods/properties.
This is a third party plugin and you can download it from CodePlex using the following link:
Use the Download link to download and install the policy executable. You need to restart Visual Studio after the installation.
Step 2) Open Team Explorer inside Visual Studio
Step 3) Open Source Control Dialog
Step 4) Click add button from the Check-in Policy tab
Step 5: Select Check for Comments item
Click Ok button
Please note that the above dialog says we have selected only Public Methods for comment requirement.
Step 6: Test the Check-in
Now we can try creating a file with comment missing for a public method.
Try checking in the file:
On checking in the above file we will get the following error dialog.
This makes sure that the Policy was Installed Successfully.
Summary
In this article we have explore the source code policy feature of Team Foundation Server and installing a custom Check-in policy