Stuck on “Cannot create unknown type {clr-namespace:” in TFS Build?


A couple of days ago I was upgrading some of my clients MSBuild tasks to WorkFlow Activities following the “Rewrite MSBuild task as a Workflow Activity” option in the guidelines from this excellent post by William Bartholomew.

I stumbled upon a custom Assembly Versioning MSBuild task and I took a moment of thought to see what I could do to improve this MSBuild task. I read this great post by Mike Fourie’s and yet another great post by John Robbins that I really encourage anyone doing custom versioning in TFS 2010 to read.

I decided to follow some of the posts recommendations and decided that for the purposes of my client I would not need to convert this (former) MSBuild task into a coded CodeActivity because a designed activity would be more then enough.

Anyway a simplified version of the clients workflow activity looked something like this:

With some input arguments that looked like this:


Everything is pretty straightforward if you’re custom to TFS Build and Windows Workflow Foundation except for the Activites in the Then/Else sections. In the Then/Else sections I’m using the AssemblyInfo Activity from Community TFS Build Extension here.


So I check-in my custom assembly and make sure that the controller is pointing to the folder in the source control tree that contains my custom assemblies.

I then added my new Activity to the build process template and ran my first build against that build process template…BOOOOOM! Got this message: TF215097: An error occurred while initializing a build for build definition \Tailspin Toys\HugoHaggmark: Cannot create unknown type ‘{clr-namespace:HugoHaggmark.TfsBuild.Activities}Example’.



Are you in the same situation as me? Don’t despair a simple solution is close. Ler

  1. Firstly open up build process template as XML.
  2. Find the reference to your Custom Activity in the XML (probably in the top section of the XML), looks something like this:
    xmlns:local=”clr-namespace:<YourNameSpace>” or in my case I had this:
  3. Add ;assembly=<Name of your assembly> to that reference so in my case the end result looked like this:
  4. Create a partial class right next to your Custom Activity and add the BuildActivity attribute like shown below:
  5. Check In, rebuild and redeploy assemblies to the custom assemblies folder.
  6. Run the build and voila! The build error is gone!



18 Replies to “Stuck on “Cannot create unknown type {clr-namespace:” in TFS Build?”

  1. Hello,

    I am getting a same error, while I am importing a Powershell Workflow activity into toolbox. Its imported successfully but while executing it gives the below error.
    TF215097: An error occurred while initializing a build for build definition Exception Message: Cannot create unknown type ‘{clr-namespace:StopService;assembly=StopService}StopService’. (type XamlObjectWriterException)Exception Stack Trace:

    The Activities has been created by using the steps in

    The DLL is created and successfully imported into workflow toolbox, but while using it in a build its giving the above error.

    1. Hi,

      I’m not sure what I can do to help you out.

      Are you saying you still have the same issue after you’ve followed the steps in my post?

  2. I’m also still stuck on this error. I have added the assembly to the namespace and already had the correct BuildActivity attribute. I’ve also tried other suggestions, like make sure the custom-activity project is build for Platform ‘Any CPU’; but it already was.
    The custom assembly does show up in the temporary assemblies folders of the build-controller & -agent, but I still get the error.

    As soon as I add the assembly to the GAC, the build works. So that’s my solution for now. But I’d really like to know why it’s not working from source control. I want to add unit test adapters (for xUnit and the like) to the build-servers later, which I would like to do through version control.

    Any suggestions are highly appreciated…

  3. Just a tip for anyone else running into this and getting stuck: If you make changes to your build activities assemblies, you may need to restart the build controller service to pick up the changes.

    1. Hi and thanks!

      How does anyone get a solution to any problem?

      Hard work I guess in this case but I’m not entirely sure as this was almost 3 years ago.

      I hope the TFS-team already solved this bug.

Leave a Reply to Hugo Häggmark Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.