随笔 - 290  文章 - 10  评论 - 85  2

Microsoft Team Foundation Server is a very powerful and customizable tool user of version control. TFS 2005 is less stable when compared to TFS 2008

Now I just faced a legitimate requirement..

When someone checks-in any file to the TFS, i need to get the list of files checked-in and perform a custom action based on that file(s) list. How do I do that??  I just need to extend the Microsoft TFS services.

TFS is nothing but a SQL Server database(s) and a Share Point Web Service. All actions to the TFS are done by calling webservices at http://yourservername:8080/…asmx. So what you need to do is listen for a particular event and then catch it and execute your code.

Build Completion Event NodesDeletedEvent
BuildStatusChangedEvent ProjectCreatedEvent
BranchMovedEvent ProjectDeletedEvent
NodeCreatedEvent CheckinEvent
NodePropertiesChangedEvent WorkItemChanged
NodeRenamedEvent

 

You can find the BisSubscribe.exe at –> C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\TF Setup\

TFS has a small interesting utility called BisSubscribe.exe, you can use this tool to subscribe to quite a few events in TFS. So, now i want to subscribe to the TFS Checkin-Event, and the command goes like this

BisSubscribe.exe /server tfsserver01 /eventType CheckinEvent /deliveryType Email /address vinubaby1@gmail.com

this will create a subscription on the tfsserver01 server for CheckIn event and a email will be sent to vinubaby1@gmail.com, but this does not serve my requirement. I need a list of files checked-in the moment it is checked in. So, i just tweak the command like this.

BisSubscribe.exe /server tfsserver01 /eventType CheckinEvent /deliveryType Soap /address http://myserver:81/service.asmx

This command will create a subscription on tfsserver01 server for Checkin event and will invoke the Notify() method in the service.asmx webservice which i developed and published in http://myserver:81/

The webservice will have the Notify command with the following signature;

[SoapDocumentMethod(Action = "http://Microsoft.VisualStudio.Bis/Notify", RequestNamespace = http://Microsoft.VisualStudio.Bis)]
[WebMethod
]
public void Notify(string eventXml)
{
     //Write your custom code here
     //Use eventXml to extract event related fields and their values
}

The signature of the Notify function should be same as above.

Happy programming….. enjoy..

posted on 2011-10-25 18:03  Gu  阅读(...)  评论(...编辑  收藏