Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Free course! Predicting the Future, Estimating, and Running Your Projects with Flow Metrics

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.)

SNAGHTMLaf4e9f

Figure 1 – Create a Workflow Console Application

SNAGHTMLb0b7fc
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\11.0.0.0__b03f5f7f11d50a3a\
      • 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. 

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

Want that project?  Download

I hope this helps.

-Ben

 

— 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.

SUBSCRIBE TO THE BLOG


8 responses to “Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities”

  1. […] Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities By Visual Studio ALM MVP Benjamin Day – […]

  2. […] Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities By Visual Studio ALM MVP Benjamin Day – […]

    1. Tore Avatar

      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.

  3. […] Edit & Compile Team Foundation Server 2012 (TFS2012) Builds with Custom Build Activities By Visual Studio ALM MVP Benjamin Day – […]

  4. Boyd Avatar

    “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

  5. Ralph Jansen Avatar

    Thanks. I couldn´t find the dll´s for Visual Studio 2012 when I wanted to upgrade from VS2010 to VS2012.

  6. Andy Burns Avatar
    Andy Burns

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

  7. Steven Avatar

    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’.

Leave a 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.