Continuous Integration Demo Code from Doug Neumann’s TLN301 PDC Talk

Avatar

Buck

Doug Neumann’s TLN301 presentation, VSTS: Behind the Scenes of Visual Studio 2005 Team Foundation Server (slides), featured a demonstration of how to use the server’s check-in event notification to kick off a build for a continuous integration build system using Team Build.  A number of people asked for it, so we’ve decided to post it here.


Doug’s demonstration used the July CTP, but since beta 3 will hopefully be released this week, the code has been modified to run on beta 3.  You’ll need to create a web service and put the following code into it.  Here are the assemblies you’ll need to reference.



Microsoft.TeamFoundation.Build.Client.dll
Microsoft.TeamFoundation.Build.Common.dll
Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll
Microsoft.TeamFoundation.WorkItemTracking.Client.dll


The code is intentionally simplified to meet the needs of a demo (e.g., a real continuous integration system would need more intelligence in handling check-in events that come in while the current build is running, etc.), but it’s a good example of how to hook into the Team Foundation server’s events and build useful extensions.


Once you’ve built and deployed your web service using VS 2005, you’ll need to add a subscription for your web service.  The check-in event is sent to your continuous integration web service via SOAP.  The following command, with changes as necessary for the name of your machine (here, I use localhost), must be run on the application tier to add an event subscription for your service.



bissubscribe /eventType CheckinEvent /userId mydomain\myusername /address http://localhost:8080/ContinuousBuild/Service.asmx /deliveryType Soap /domain localhost


Now when you check code into your server, your continuous integration service will kick off a build.


The Team Build team plans to post a more elaborate continuous integration example.


[UPDATE 2/20/06]  I updated the version numbers in the SoapDocumentMethod attribute to work with RC and RTM releases.

Avatar
Buck Hodges

Follow Buck   

0 comments

    Leave a comment