|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
The policy evaluation process occurs while a user interacts with the IDE, and when he or she uses the check-in dialog box, both within and outside of Visual Studio. Policy evaluation indicates, in real-time, whether the user currently satisfies the policy requirements defined for the team project. Current check-in information goes to the policy plug-ins at strategic times. The plug-ins determine whether the policy is satisfied currently. The plug-ins return the information to the policy framework. The framework displays this information to the user on the policy channel of the Pending Changes tool window or the same channel on the check-in dialog box.
Each entry in the policy failure dialog box denotes a defined policy that is not satisfied. If there is compliance, a single entry appears with a description that reads “All check-in policies are satisfied.”
You can double-click a policy failure if you want more information. The double-click event invokes a method on the policy plug-in that the plug-in can handle in its own manner. For example:
Invoke the details for the failed policy so the user can get more information.
Invoke the Help system to get an explanation of the failure and a description of how to fix the failure.
Initiate an activity, such as running a static analysis or a check-in of the unit tests, to fix the policy failure.
A policy defined for a team project will fail if the user does not have the corresponding policy plug-in. In this case, the user gets a message indicating that the policy plug-in does not exist on the local machine. If the person who defined the policy provided a URL for Help or installation information, the user gets a message that says “Double-click for more information.” Double-clicking starts the Web browser and takes the user to the specified URL. If the creator of the policy did not provide a URL, the user gets this message: “Contact your project administrator for help installing this policy add-in.”
You can still go to check-in even if you do not satisfy policy. Click the check-in button and the policy dialog box will appear.
If you do not override the policy when this dialog box appears and choose instead to click Cancel, the focus returns to the check-in user interface. This activates the policy channel, which then displays the list of policy failures. If you override the policy failure by selecting the checkbox, the system then brings up the Reason text box. Now you can provide more information about why you are checking in despite the policy failure. The system preserves the policy failure and reason along with the changeset information. The reason is included in the notification that is delivered to subscribers.