Continuous Integration for Visual Studio 2005 Team System beta 2

As you may or may not know, the current beta 2 version of Visual Studio 2005 Team System only supports manual team builds against the Team Foundation server. I think the final release of VSTS is going to support scheduled builds (e.g. nightly builds), but I don't think continuous integration will be supported (because Microsoft don't practice CI themselves).

However my company enforces their developers to use Continuous Integration on all projects, so I had to build a CI process for Team System myself.
I thought it was a good idea to share the results with you :)

I enabled continuous integration by setting up a scheduled MSBuild project that runs every 5 minutes. It includes 4 custom MSBuild Tasks I've created (also see Visio drawing at the bottom):

  • CheckWorkspaceUpToDate : Checks if any files were changed on the local server workspace since last run. Uses the h.exe (as of Hatteras) command.
  • StartTeamBuild : Starts a Team Build by calling the BuildContoller.asmx WebServices (thanks to Aaron Engel for sample code)
  • GetUnexaminedBuild : If available, returns a finished build from Team Foundation where build quality is "Unexamed". The status of this build will be notified to all team members using messenger, and the build's build quality will be set to 'Notification Sent'.
  • MessengerNotification : Task to send an arbitrary message through MSN messenger (using SendMSN that uses the DotMSN library; thanks to James Simmonds and B.Geertsema)

Because you're all such nice people, I decided to share my code and binaries. Download it here.

To run this Continuous Integration process on your own server, take the following steps:

  1. Create a Team Build using the wizard in Team System (if you already have created a Team Build, skip this step).
  2. Create a workspace on your server, and map your project's repository-folder to a local file folder on that server. Do a 'Get Latest' on this folder. Note: first time you do a teambuild, a workspace will automatically be created on the buildserver; it's best to use this generated workspace.
  3. From the downloaded zip, extract "Macaw.MSBuild.Tasks.dll" and "DotMSN.dll" (or build them yourself). Add these libraries to the GAC.
  4. From the downloaded zip, extract "/MSBuild Examples/ContinuousIntegration.proj" and put this somewhere on your hard disk (e.g. c:\teambuilder)
  5. Edit the ContinuousIntegration.proj MSBuild project, and change all properties in the <PropertyGroup> to match your environment.
  6. Test ContinuousIntegration.proj (run as argument of MSBuild.exe, which can be found in the .NET framework folder).
  7. If ContinuousIntegration.proj is working well, schedule it to run every 5 minutes: schtasks /create /SC MINUTE /MO 5 /TR [batch file to run] /TN [scheduled task name]. Note: The [batch file to run] should contain a command like: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe c:\teambuilder\continuousintegration.proj".

2 Comments

  • Do you really need to poll BuildInfo - you should be able to subscribe to the &quot;Anything checked-in alert&quot; - in code you can supply a soap endpoint, this end point could then kick off the build...

  • Careful with statements like &quot;Microsoft don't practice (CI) themselves.&quot; The patterns &amp; practices group uses it religiously on ALL of our development projects. :)

Comments have been disabled for this content.