Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities


So, you’ve all downloaded and installed your copy of Team Foundation Server 2012 and Visual Studio 2012, right?  Of course you’re migrated all your code and servers over to TFS2012 and VS2012, right?  (Answer: heck yes! We’ve been running it in production since the Alphas!)  NICE!

Anyway…I’ve been doing some TFS2012 build customization work lately and working on porting my custom TFS build activities to .NET 4.5 and all the latest and greatest.  When I’m editing a custom XAML build script with custom activities in it, I find that it’s helpful to be able to compile my build scripts before I check them in to TFS so that I can hopefully make sure that they’re error-free. 

The way that I do this is to create a Workflow Console Application (Figure 1) and then add my TFS2012 Build Script (*.xaml) to this project (Figure 2). 

(Feeling lazy?  You can skip these steps and just download my project.)


Figure 1 – Create a Workflow Console Application

Figure 2 – The Team Foundation Server 2012 XAML Build Script in the project

When I first add the build script to the new project, I’ll get a zillion compile errors because the script makes a lot of references to assemblies and none of these assemblies have been added to the References for the project yet. 

Here are the references that need to be added to your project and where to find them:

    • C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies
      • Microsoft.TeamFoundation.TestImpact.BuildIntegration.dll
      • Microsoft.VisualStudio.TeamFoundation.dll
    • C:\Windows\assembly\GAC_MSIL\Microsoft.TeamFoundation.TestImpact.Client\\
      • Microsoft.TeamFoundation.TestImpact.Client.dll
    • C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0
      • Microsoft.TeamFoundation.Build.Client.dll
      • Microsoft.TeamFoundation.Build.Workflow.dll
      • Microsoft.TeamFoundation.Common.dll
      • Microsoft.TeamFoundation.VersionControl.Client.dll
      • Microsoft.TeamFoundation.VersionControl.Common.dll
      • Microsoft.TeamFoundation.WorkItemTracking.Client.dll
    • Assembly References
      • System.Activities.Presentation
      • System.Drawing
      • PresentationCore
      • PresentationFramework
      • WindowsBase

Once you add these references to the project, you can then modify the XAML script through the designer and then run Build Project to verify that it doesn’t have any compile errors. 

Figure 3 – Editing the TFS2012 Build script in the XAML designer

Want that project?  Download

I hope this helps.



— Looking for help getting rolling with Team Foundation Server 2012?  Need some pointers on how to customize your TFS2012 Builds?  Want to move your Scrum or Agile project management tasks in to Visual Studio 2012 and TFS2012?  Drop us a line at info@benday.com.

8 Responses to "Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities"
  1. “Benjamin Day Consulting, Inc. | Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities”
    was a fantastic posting. If merely there was a lot more websites like this particular one in the word wide
    web. Regardless, thank you for your personal precious time, Sharon

  2. Thank you, I’ve been struggling to get my process to build, and the Microsoft.TeamFoundation.TestImpact.BuildIntegration.dll proved particularly hard to find.

  3. Benjamin,

    After following the steps in this tutorial, I still couldn’t build my ‘BuildEditor’ project.

    Error 1 Unknown build error, ''clr-namespace:TfsBuild;' mapping URI is not valid.

    The solution was to change the build action for the .xaml template file from ‘Page’ to ‘XmlAppDef’.

  4. any test you don’t run regularly (either as part of a build or bfeore check in) might as well be thrown away it’s a bad test.Tried mocking?A nice thought from CITConf last year was that perhaps a slow test suite was a sign of bad design or at least an indicator that there’s a problem.

Leave a Reply

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

%d bloggers like this: