Deploying Process Template Changes Using TFS 2010 Build



UPDATED (24 June 2013):  This should work now with TFS 2012 as well.  Have included a download link to the SkyDrive folder with both versions of the build process template XAML file.  Thanks a ton to Neno Loje for figuring out what updates were necessary to get it to work for TFS 2012!

 

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 – 6/24/2013]

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).
  • 6/24/2013Neno provided an update of the build process template .XAML that works with Team Foundation Server 2012 as well.  Check out our new TFS 2012 book!

Download the Build Process Template for TFS 2010 or TFS 2012

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, 08 September 2010 08:56:56 (Pacific Daylight Time, UTC-07:00)
Could you post a sample of the Work Item Type Definition files?
Nelson
Thursday, 14 October 2010 04:41:50 (Pacific Daylight Time, UTC-07: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, 24 March 2011 08:06:22 (Pacific Standard Time, UTC-08: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, 09 September 2011 14:18:42 (Pacific Daylight Time, UTC-07:00)
I can't down load
MSCM
Friday, 09 September 2011 14:20:14 (Pacific Daylight Time, UTC-07:00)
Sorry, I meant to say I can not download Build Process Template
MSCM
Thursday, 02 February 2012 10:19:48 (Pacific Standard Time, UTC-08: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, 02 February 2012 10:22:38 (Pacific Standard Time, UTC-08:00)

Have you tested this with dev11?


Hey Martin - no, I haven't tested this out with TFS "11" just yet.
Thursday, 07 February 2013 07:23:48 (Pacific Standard Time, UTC-08:00)
Hi Ed, I have been using your tool to keep Work Items under control since your first blog on the subject.

However, moving to TFS 2012 I encounter the following build error

Other Errors and Warnings
1 error(s), 0 warning(s)
The process parameter BuildSettings is required but no value was set. A value must be set on the definition or when the build is queued (Category: #100 Required, Display Name: Items to Build).

Section I believe is giving rise to the problem

<mtbw:ProcessParameterMetadataCollection>
<mtbw:ProcessParameterMetadata Category="Required" Description="The list of Work Item Type Definition (XML) files to be used. Specify each file's server path.&#xA;&#xA;Make sure that each entry matches directly with an entry in the Work Item Type Names list." DisplayName="Work Item Type Definition Files" Editor="Microsoft.TeamFoundation.Build.Controls.BuildProjectListEditor, Microsoft.TeamFoundation.Build.Controls" ParameterName="WorkItemTypeDefinitionFiles" Required="True" />
<mtbw:ProcessParameterMetadata BrowsableWhen="Never" Category="Overrides" Description="Don't need this parameter in this build template." DisplayName="Items to Build Override" ParameterName="BuildSettings" />
<mtbw:ProcessParameterMetadata Category="Required" Description="This is the full URL to the team project collection to use for updating. For example: http://tfs.contoso.com:8080/tfs/DefaultCollection" DisplayName="TFS Server Collection URL" ParameterName="TeamFoundationServerCollectionUrl" Required="True" />
<mtbw:ProcessParameterMetadata Category="Required" Description="This is the list of the work item type names to be updated.&#xA;&#xA;For example: Bug, Task, Test Case, Shared Steps&#xA;&#xA;Make sure that each entry matches directly with an entry in the Work Item Type Definition Files list." DisplayName="Work Item Type Names" ParameterName="WorkItemTypeNames" Required="True" />
<mtbw:ProcessParameterMetadata Category="Required" Description="List the name of each team project to be updated." DisplayName="Team Projects" ParameterName="TeamProjects" Required="True" />
</mtbw:ProcessParameterMetadataCollection>

In particular

BrowsableWhen="Never" Category="Overrides" Description="Don't need this parameter in this build template." DisplayName="Items to Build Override" ParameterName="BuildSettings”

How do I find out what values are valid for Category ?

This functions under TFS 2010 build environment but not under the TFS 2012 version. Has anything changed at TFS 2012 that would cause this?

I have updated to the latest version on your website.

This is great functionality ensuring that any process changes (mods to bugs etc) are updated in a manageable, version controlled manner.

Any help would be most welcome.
Graham Pembery
Wednesday, 27 February 2013 21:02:03 (Pacific Standard Time, UTC-08:00)
Graham I'm running into the same problem. Same error message - "The process parameter BuildSettings is required but no value was set. A value must be set on the definition or when the build is queued (Category: #100 Required, Display Name: Items to Build)."
Brian Rue
Tuesday, 12 March 2013 16:02:20 (Pacific Standard Time, UTC-08:00)
I'm getting the same error. "The process parameter BuildSettings is required but no value was set. A value must be set on the definition or when the build is queued (Category: #100 Required, Display Name: Items to Build)."
Scott Alen
Friday, 22 March 2013 10:01:15 (Pacific Standard Time, UTC-08:00)
Same error: "The process parameter BuildSettings is required but no value was set. A value must be set on the definition or when the build is queued (Category: #100 Required, Display Name: Items to Build)."

How can I solve this?

Thank's
André Maldonado
Friday, 22 March 2013 10:03:25 (Pacific Standard Time, UTC-08:00)
Hi Andre!

It looks as though there were a few changes between TFS 2010 and TFS 2012 that will require some updates to get this to work with TFS 2012. I've been looking over this with Neno Loje in the last week or so. Stay tuned. :)

Ed B.
Thursday, 18 April 2013 11:51:14 (Pacific Daylight Time, UTC-07:00)
Hey Ed, any update would love to use your template and or figure out how to fix my own 2012 template issues.
Richard A
Monday, 24 June 2013 11:21:31 (Pacific Daylight Time, UTC-07:00)
Should be working now for TFS 2012! Check out the updated link.
Thursday, 22 August 2013 09:43:14 (Pacific Daylight Time, UTC-07:00)
Ed - The link to latest 2012 version appears to broken ;-(
SMartin
Friday, 13 September 2013 08:06:56 (Pacific Daylight Time, UTC-07:00)
Many thanks for the update Neno and Ed. All working on TFS 2012!
Graham Pembery
Wednesday, 25 February 2015 08:41:32 (Pacific Standard Time, UTC-08:00)
I'm having difficulty accessing the file on the OneDrive share. Can you please verify the link and update?

Thank you,
Larry
Monday, 23 March 2015 09:12:11 (Pacific Standard Time, UTC-08:00)
Hello Ed,
Thank you for this template, it works perfectly.
Just one thing - after deploying the templates, when i'm opening one of them from the server
(using process editor) i see the version before the deployment. But at the same time when i do export
(using witadmin) of the same template i see the last version that was checked in.
So i believe there is a missing kind of refresh or something like this?!
Thank you
Andrey
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">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview