26.04.2015 Views

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How To: Create Custom Check-in Policies in <strong>Visual</strong> <strong>Studio</strong><br />

<strong>Team</strong> <strong>Foundation</strong> <strong>Server</strong><br />

Applies To<br />

• Microsoft® <strong>Visual</strong> <strong>Studio</strong>® 2005 <strong>Team</strong> <strong>Foundation</strong> <strong>Server</strong> (TFS)<br />

• Microsoft <strong>Visual</strong> <strong>Studio</strong> <strong>Team</strong> System<br />

Summary<br />

This How To article walks you through the process of creating, registering, and applying<br />

a custom check-in policy for TFS. Check-in polices allow you to run rules whenever a<br />

developer attempts to check-in a source file, in order to ensure that the source file being<br />

checked-in meets a specified set of criteria. As an example, this How To article uses a<br />

custom policy to enforce that check-in comments are supplied <strong>with</strong> all check-ins. To<br />

implement a custom check-in policy, you create a class that derives from PolicyBase and<br />

implements the IPolicyDefinition and IPolicyEvaluation interfaces. You register the<br />

policy assembly in the Microsoft Windows® registry and you apply the policy to your<br />

team project.<br />

Contents<br />

• Objectives<br />

• Overview<br />

• Before You Begin<br />

• Summary of Steps<br />

• Step 1 – Create and Build a Custom Policy Class.<br />

• Step 2 – Register the Custom Policy Class in the Windows Registry<br />

• Step 3 – Apply the Custom Policy.<br />

• Step 4 – Validate the Custom Policy.<br />

• Additional Considerations<br />

Objectives<br />

• Learn what a custom check-in policy is<br />

• Learn how to create, register, and apply custom check-in policies.<br />

Overview<br />

Check-in policies enforce constraints whenever files are checked into source control.<br />

<strong>Team</strong> <strong>Foundation</strong> <strong>Server</strong> provides a number of out-of-box check-in policies including<br />

policies to check that unit tests have run and been passed, policies to perform static code<br />

analysis to ensure that code meets coding standards and .NET guidelines, and policies to<br />

check that work items are associated <strong>with</strong> check ins. The Microsoft <strong>Visual</strong> <strong>Studio</strong> 2005<br />

<strong>Team</strong> <strong>Foundation</strong> Power Tool also provides a number of additional check-in policies. In<br />

this How To article, you will learn how to create, register, and apply a custom policy. The

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!