Jakob Ehn

Visual Studio ALM MVP @Inmeta Crayon
posts - 45, comments - 240, trackbacks - 0

My Links

News

Microsoft Community Contributor Award 2011

Twitter





Tag Cloud

Archives

Post Categories

Blogs

Thursday, December 08, 2011

TFS 2010 Build - Troubleshooting the TF215097 error

Anyone working with developing custom activities in TFS 2010 Build has run into the following dreadful error message when running the build:

TF215097: An error occurred while initializing a build for build definition \TeamProject\MyBuildDefinition: Cannot create unknown type '{clr-namespace:[namespace];assembly=[assembly]}Activity


What the error means is that when the TFS build service loads the build process template XAML for the build definition, it can’t create an instance of the customer workflow activity that is referenced from it.

The problem here is that there are several steps that all need to be done correctly for this process to work.

Make sure that:

  • When developing custom workflow, you keep the XAML builds template workflows in one project, and the custom activities in another project. The template workflow project shall reference the custom activities project.
    This setup also makes sure that your custom activities show up in the toolbox when designing your workflow.

  • You have checked in the modified version of the XAML workflow (easy to forget)

  • Your custom activity has the the BuildActivityAttribute:


    image

  • Your custom activity is public (common mistake…)

  • You have configured your build controller with the path in source control where the custom activities are located


    image


  • Verify that all dependencies for the custom activity assembly/assemblies have been checked into the same location as the assembly
    NB: You don’t need to check in TFS assemblies and other references that you know will be in the GAC on the build servers.

  • The reference to the custom activity assembly in the XAML workflow is correct:
  • xmlns:obc="clr-namespace:Inmeta.Build.CustomActivities;assembly=Inmeta.Build.CustomActivities"
    


But, even if you have all these step done right, you can still get the error. I had this problem recently when working with the code metrics activities for the http://tfsbuildextensions.codeplex.com/ community project.

The thing that saved me that time was the Team Foundation Build Service Events eventlog. This is a somewhat hidden “feature” that is very useful when troubleshooting build problems. You find it under Custom View
in the event log on the build servers


image

In this case I had the following message there:

Service 'LT-JAKOB2010 - Agent1' had an exception:
Exception Message: Problem with loading custom assemblies: Method 'get_BuildAgentUri' in type 'TfsBuildExtensions.Activities.Tests.MockIBuildDetail' from assembly 'TfsBuildExtensions.Activities.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. (type Exception)

Which made me realize that I had by accident checked in one of the test assemblies into the custom activity source control folder in TFS.


Unfortunately this whole process with developing you own custom activities is problematic and error prone, hopefully this will be better in future versions of TFS. Once you have your setup working however, changing and adding new custom activities is easy. And deployment is a breeze thanks to the automatic downloading and recycling of build agents that the build controller handles.

Posted On Thursday, December 08, 2011 8:51 PM | Feedback (2) | Filed Under [ TFS Team Build VSTS 2010 ]

Powered by: