The Ramblings of Two Microsoft .NET Developers, TFS, and Visual Studio ALM Guys --- "Yes, we are both named Ed."

Deploying Process Template Changes Using TFS 2010 Build



I mentioned in my last blog post about using TFS to manage TFS that I’d talk a little about how I use TFS 2010 to manage and deploy process template changes.  I’m excited to be able to provide some more details about it!

Background

I use to create batch files for deploying process template changes and store them in version control.  There’s certainly nothing wrong with that approach but I really wanted have an easier way to maintain this process that allowed reusability and even continuous integration.  Whenever I checked in a change to the process template branch for the test environment, I wanted it to immediately deploy those changes to that environment.  I also wanted to make it super easy for others to be able to make changes and then queue a deployment.

I need a build definition using TFS 2010 Build!

Build Process Template

So I have created a build process template that does exactly this.  My goals for this process template were to not require any custom workflow activities or custom assemblies to be required to get the build process template to work.  You simply only need to check-in the XAML file and begin using it.  That one requirement ended up being tougher to follow than I originally thought.  I had to take a few alternate methods that didn’t always end up with the best user experience but I think you’ll see that the template is still helpful.  (If you have ideas for improvements, please let me know!)

I hope you’ll see it as an example for creating “builds” that don’t necessarily compile & run tests.  Using Windows Workflow Foundation in Team Build 2010 makes it extremely useful for any type of process you want to automate.

Overview

At a high level, here is what this build process template attempts to accomplish:

  • Standard Build Features:
    • Build Versioning
    • Label the source using the version number
    • Getting Latest Version or Specific Version
    • Associate Changesets & Work Items
    • Gated Check-In, Continuous Integration, etc.
  • Ability to specify multiple team projects to update
  • Ability to specify multiple work item types to update
  • Backup each of the the work item type definitions that are currently being used in each team project (just in case!)
  • Copy the version of the work item type definitions that are used and backups to a drop folder

Disclaimer:  I’m going to give this template the “works on my machine” label.  This template may not perform as advertised including blowing up your server, deleting everything on your hard drive, or cause your hair to fall out.  Use at your own risk!  You have been warned.  If it works for you, awesome!  If not, please let me know about any issues or areas of improvement.

How to Use the Build Process Template

After you downloaded the template and check the XAML file into your build process templates folder, you’ll want to create a new build definition to use it.  Make sure you have also checked in your process template to a version control folder.

Workspace Definition

Specify the version control folder that contains your process template.  By default it will download the entire team project and scoping down the build process template allows your build to run quicker since it is not downloading everything in the team project.

image

Process Tab

Choose the new build process template file from the available process templates:

Note:  If you don’t see the build process template as an available item in the combo box, you’ll want to click New and then choose the XAML file you checked in as the existing build process template.

image

The next thing you’ll want to do is specify the team projects you want to update and the URL for your TFS 2010 team project collection.

image

The last two required process parameters are extremely important.  You need to specify the work item type names and the server path locations to the work item type definition (XML) files.  Each of the process parameters are string lists so you’ll want to make sure you match them up in the exact order in both lists.

Work Item Type Names (for MSF Agile)

SNAGHTML996183

Work Item Type Definition Files

Make sure you specify the server path location for each of the WITD files!  I ended up reusing a dialog for this purpose that you may have been used to seeing in other builds you have configured.  It’s the same editor that allows you to choose solution and project files to build.  We can use it for this purpose too!  Just be sure to select the “All files (*.*)” filter for the Items of Type combo-box.

SNAGHTMLa1fa96

Again – make sure you put each of the XML files in the same order that you used for the work item type names.  For example, your Bug.xml file will be the first in the collection and UserStory.xml will be the last if we are using the same WITs as the figure above.

Other Details

Make sure that your build agents have Visual Studio Team Explorer 2010 installed so that witadmin.exe will be located.  You can always use the new build agent tagging functionality to identify which agents have Team Explorer available and then use the Agent Settings process parameters to limit the build to only reserve agents with the tags you specify.

Finally, make sure your build service account has the appropriate permissions to be able to import new work item type definitions to your team projects.

[Updated – 3/24/2011]

Thanks for reporting feedback and bugs!  Latest version includes the following bug fixes and improvements:

  • 10/26/2010:  Will properly associate work items and changesets correctly now.
  • 10/26/2010:  Discovers location of witadmin.exe on build servers with a 32-bit OS installed.
  • 10/26/2010:  Detects error on import and writes as build error instead of message.  Allows for the build to not succeed in this circumstance.
  • 3/24/2011:  Reduced the verbosity of some of the build workflow activities.  This should reduce the noise in the build log and show what is most important.  Be sure to set the entire build’s verbosity higher if you need to troubleshoot issues.  (If you are interested in how to lower a particular workflow activity’s tracking verbosity, check out page 402 in our new TFS 2010 book).

 

Download the Build Process Template

 

Let me know if you have any feedback about things you like or areas for improvement!  Feel free to comment below so I don’t lose track of the suggestions. Smile

Ed Blankenship



Wednesday, September 08, 2010 11:56:56 AM (Eastern Daylight Time, UTC-04:00)
Could you post a sample of the Work Item Type Definition files?
Nelson
Thursday, October 14, 2010 7:41:50 AM (Eastern Daylight Time, UTC-04:00)
Hi Ed,
Fantastic build definition! This one is going into my deep archive for future use.
I'll have alot of use for this in the future and recommend it to anyone who migh have use for it.

Thank you so much for sharing.
Thursday, March 24, 2011 11:06:22 AM (Eastern Standard Time, UTC-05:00)
Thanks Patrik! I'm glad you found some good use out of it.

RE: Nelson - You can download the out of the box process templates (that include the Work Item Type Definitions) by following this guidance: Download a Process Template. Let me know if you have any additional questions.
Friday, September 09, 2011 5:18:42 PM (Eastern Daylight Time, UTC-04:00)
I can't down load
MSCM
Friday, September 09, 2011 5:20:14 PM (Eastern Daylight Time, UTC-04:00)
Sorry, I meant to say I can not download Build Process Template
MSCM
Thursday, February 02, 2012 1:19:48 PM (Eastern Standard Time, UTC-05:00)
Ed,

Have you tested this with dev11?

I am using dev11 as my source control & build, but I am deploying to dev10.

-MrHinsh
Thursday, February 02, 2012 1:22:38 PM (Eastern Standard Time, UTC-05:00)

Have you tested this with dev11?


Hey Martin - no, I haven't tested this out with TFS "11" just yet.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview