Friday, August 18, 2006

So here goes my first post - it's about extending Visual Studio Team System - to force developers to post comments when Checking In items.

Of course there are a lot of articles on this topic on the web - but after starting a thread on forums.microsoft.com (http://forums.microsoft.com/MSDN/showpost.aspx?postid=645398&siteid=1)
i was asked to post my solution and this is how i got to this.

First you should create a new Class Library project (of course the plugin you will create is a DLL that you will register with VSTS through a registry key) - now that's all set add a reference to Microsoft.TeamFoundation.Version.Control that is usually located under [C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Client.dll] .

Now all you have to do is to extend the PolicyBase class in the above mantioned namespace and you've got your plugin all set.

Now for the registration part - you should add a registry key of type REG_SZ under
HKLM\Software\Microsoft\VisualStudio\8.0TeamFoundation\SourceControl\Checkin Policies
with the name of your plugin (without the .dll extension) and the value is the absolute path to your dll.

Now for activating the freshly built plugin you shoul open VS>Team Explorer, login as an admin, right click on the project for which you want the policy to be enforced and go to Team Project Settings > Source Control.

A dialog box will pop up and under Check-In Policy click Add - you should now see here the policy you've registered - select it, click ok, ok again and you're done.

Let's hope this was helpfull enough -

Here's a link to my original project - it also contains a setup so no more headackes whith registry keys and stuff - even no coding required if you build the setup :-P.
http://hal.cs.tuiasi.ro/~mariusonofrei/CustomCheck-inPolicy.zip

Good luck !