Upgrading your Custom Build Template to TFS 2012

In the past years I have been quite busy with customizing the build for both my own and also custom organizations.

Today I was experimenting with the build definitions on my TFS 2012 Release Candidate installation.

I attached a TFS 2010 Team Project Collection to my TFS 2012 Server as my first step and this works like a charm!

My projects are automatically updated with new Build Definitions.

image

Then, I tried to run my own custom build. My custom build was based on the Default Template of TFS 2010. It failed, because of my custom assemblies referencing assemblies that were upgraded.

I opened the solution with my build assemblies and build template. I did the trick of the unused namespace described by Jason Prickett here and I updated my custom assemblies project to reference the new versions of the TFS API and ran again, redeployed everything and ran! (For info about setting up custom build solutions, Ewald Hofman has a great blog series about customizing the build)

Then something strange happened.

I got a few error messages

image

The build process failed validation. Details:
Validation Error: The private implementation of activity ’1: DynamicActivity’ has the following validation error:   Compiler error(s) encountered processing expression "testAssemblies.Count() > 0".
‘Count’ is not a member of ‘System.Collections.Generic.IEnumerable(Of String)’.

Validation Error: The private implementation of activity ’1: DynamicActivity’ has the following validation error:   Compiler error(s) encountered processing expression "WorkspaceName.Length > Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize".
‘Common’ is not a member of ‘VersionControl’.

Validation Error: The private implementation of activity ’1: DynamicActivity’ has the following validation error:   Compiler error(s) encountered processing expression "WorkspaceName.Substring(0, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize).TrimEnd()".
‘Common’ is not a member of ‘VersionControl’.

Validation Error: The private implementation of activity ’1: DynamicActivity’ has the following validation error:   Compiler error(s) encountered processing expression "String.Format("The workspace name ‘{0}’ exceeds the maximum allowed limit of ‘{1}’ characters. Truncating it to match the maximum limit.", WorkspaceName, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize)".
‘Common’ is not a member of ‘VersionControl’.

Validation Error: The private implementation of activity ’1: DynamicActivity’ has the following validation error:   Compiler error(s) encountered processing expression "String.Format("{0}_{1}_{2}", BuildDetail.BuildDefinition.Id, Microsoft.TeamFoundation.LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId, BuildAgent.ServiceHost.Name)".
‘LinkingUtilities’ is not a member of ‘TeamFoundation’.

 

This was strange, because it all seemed framework assemblies to me.

When I compared the new DefaultTemplate.11.1.xaml with my own template, I saw some small differences in naming activities and some extra checks but the new template referred to the same assemblies and methods as my own !

I looked further and then I saw the difference. DefaultTemplate.11.xaml contained extra import statements.

image

The ones that were missing for my template were:

  • Microsoft.TeamFoundation.Common
  • System.Linq
  • Microsoft.TeamFoundation.VersionControl.Common

I added these references to my project containing my Build Process Templates and added these to the imports of my workflow.

After re-deploying the build template (and of course my new custom assembly against TFS API 2012), my build worked like a charm !

Hope this helps!

About these ads

3 Responses to “Upgrading your Custom Build Template to TFS 2012”

  1. Can you provide full list of imports for your workflow? I have same situation and adding these three references not worked for me.

    • Hi,

      You can see the list in the screendump of my post. But it really depends what you are using in your custom template.

      Check the workflow designer if you see some exclamation marks on certain activities. If so, find the namespace and add the import. Also make sure that all assemblies that you reference in your project (in the solution explorer) are added to the imports section.

      Hope this helps!

  2. Thanks! with these thousand assemblies everywhere, this would have cost me forever to find, what’s wrong! :-D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 47 other followers

%d bloggers like this: