This project is read-only.

IMPORTANT - This documentation relates to the TFS 2012 and earlier versions of these activities. New development has moved to Github


The Codeplex Community TFS Build Extensions contains a wide variety of activities that can be used with the TFS 2010 or 2012 build process. However, the way to use them is sometime less than obvious. This is not helped by the complexity in using any custom activity within TFS 2010/2012 builds.


In this example we do not  show how to get any specific activity working, it is assumed once you have done this initial setup you will follow the documentation for the specific activity you wish to use.

Actions to be Done Once

Get the Custom Activity and Supporting Files

  1. Download any external tools required for the activity you are using and install on you development PC e.g. the StyleCop  distruction files if you the StyleCop activity
  2. Download and unzip the Community TFS Build Extensions to a directory on you development PC. The zip file contains both 2012 and 2013 version of the custom activities.

Get the files onto the build box

The assemblies that contain the custom activity and StyleCop need to put under source control so they are available to the build controller and agent(s).

  1. In Visual Studio open Source Control Explorer select your Team Project and map the BuildProcessTemplates folder to a location on your local disk.
  2. Create a new folder under the BuildProcessTemplates called Custom Assemblies
  3. In this  Custom Assemblies new folder copy all the assemblies from the unzipped TFS Build Extensions  Make sure you copy the correct version of the assemblies as required.
  4. Also copy any extra files you require e.g for StyleCop you also need the StyleCop DLL from C:\Program Files (x86)\StyleCop 4.7 to  Custom Assemblies
  5. From within Source Control Explorer add these new files to the new Custom Assemblies folder and check the files into TFS.
  6. Open Team Explorer, right-click on Builds and select Manage Build Controllers
  7. Select the controller to configure, and then select Properties
  8. Set the Version control path to custom assemblies to the location just created under version control containing your added assemblies

Get the custom activities into Visual Studio

Next we need to get the activity into Visual Studio so we can add it to build process

  1. Open Visual Studio (use the version that match the version of TFS you are using)
  2. Create new Class Library project, this new project is only going to be used as a container for the editing of the build process template. IMPORTANT - this project must target .NET 4.0 if on TFS 2010 and .NET 4.5 if in TFS 2012. 
  3. Delete the Class1.cs file
  4. In Solution Explorer right click and select Properties., make sure the new project does not build in any configuration.

Now we have a project to work with, we need to get a process template into it, this can be done by branch the process template into the project for adding it as a link. In this example we use a link to one of the standard template in the BuildProcessTemplates folder, for simplicity. Remember we would normally recommend at least copying the process template in the BuildProcessTemplates folder prior to editing it.

  1. Make sure BuildProcessTemplates is mapped in you current workspace and get a local copy on your development PC
  2. In the new project select Add Existing Item and browse to local folder mapped to the BuildProcessTemplates, select the template your wish to edit. But, don’t just press the Add button, but use the drop down to select Add as link.
  3. On the added file set the build action property to none
  4. Select Add Reference and add references to all the assemblies from the unzipped TFS Build Extensions
  5. Open the newly added process template in VS2010, this can be slow, so wait…..
  6. Open the toolbox and you should see all the standard build activities
  7. Right click in the toolbox and select Choose Item, select browse and select the file assembly files you need e.g for for StyleCop select the  TfsBuildExtensions.Activities.StyleCop.dll.
  8. The new activity should now be in the toolbox

Editing the XAML Process Template

We can now start to edit the process template mapped in the previous step to add our custom activities.

In this example we are Using the DefaultTemplate, find the ‘Compile the Project’ sequence and add the activities as show in a graphic below. How and where you add the activities to the workflow will depend on activity in use, some require the compilation to be completed some do not.

The follow figure show a possible  workflow for using the StyleCop activity



Running the Build

If you have not done so already create a build using this process template. It is worth remembering here that you do not need to do any previous steps on a development PC as long as you DO NOT wish to edit the process template on that PC. You can create a new build that uses your template with custom activity on any PC.

So create a new build using the edited template. Run the build and if it is all OK you should see a build log similar to the graphic below including your new activities output


Last edited Aug 2, 2014 at 11:46 AM by rfennell, version 12


bjamri Jul 17, 2014 at 1:43 PM 
Very helpfull except one thing: step 6 under "Get the files onto the build box" does not work in Visual Studio 2013 (Ultimate). Right-click on Builds gives only one option, which is "Open".
For VS2013 step 6 would be "Open Team Explorer, click on Builds, then click Actions and select Manage Build Controllers".

jimafisher Sep 16, 2013 at 5:25 PM 
The following issue might have to do with my configuration as opposed to a problem with VS2012 or the instructions, but I am posting in the hope that it helps someone else (and that the instructions can be updated to cover the case).

If I follow the instructions using VS2012 Update 3, when I open the DefaultTemplate.11.1.xaml (the default template for TFS2012) file that is linked to the project it opens in the XAML UI Designer and I get the following error:
The name "Activity" does not exist in the namespace ""

If I follow the instructions using VS2010 (latest SPs / patches), when I open the DefaultTemplate.xaml (the default template for TFS2010) file that is linked to the project it automatically opens in the Workflow Designer. Note: I get all kinds of error messages but at least the file opens.

In VS2010, if I RIGHT-click the .xaml and select "Open With" in my case the default selection is "Automatic Editor Selector (XML) (Default)".

In VS2012, if I RIGHT-click the .xaml and select "Open With" at least for my machine the default selection was "XAML UI Designer (Default)". I changed "Automatic Editor Selector (XML)" to be the default. This time the file loaded in the Workflow Designer without the "Activity" error but instead I got the following error:
"Workflow Designer encountered problems with your document
Please check the document for invalid content, namespaces, references or reference loops.
'The type ‘InArgument(mtbwa:BuildSettings)’ of property ‘BuildSettings’ could not be resolved.' Line number '3' and line position '38'."

The above error was caused by the fact that I had switched the project's .NET Framework version to 4.0 so that I could try opening the solution in VS2010. In VS2012, I switched the project back to using 4.5 and opened DefaultTemplate.xaml; this time the file opened in the Workflow Designer without any errors in VS2012.

Now back to actually following the rest of the instructions.

kevinnovak Jun 28, 2013 at 5:22 PM 
These tools are helpful, however, several of the DLLs are NOT "Strong Named" which prevents them from being installed in the GAC.

andipandi Mar 25, 2013 at 3:24 PM 
extremely useful, many thanks!
(@ms: a bit involved for something that should be an off-the-shelf task)

hamid_shahid Sep 25, 2012 at 3:35 PM 
Excellent article. Greatly helped me in setting up code coverage for our builds

andyste1 May 14, 2012 at 12:39 PM 
How do I configure this to pick up both the solution-specific settings file and a "global" file located higher up in the TFS project's folder hierarchy?

chandrashekar Apr 19, 2012 at 12:45 PM 
I am using stylecop activity in my build, I have seen some stylecop errors in the report but it is not breaking the build. Can you please help me, which property should I use to break the build when stylecop has errors.

Thanks & Regards,

dansten Dec 12, 2011 at 2:10 PM 
If you are going to use the steps described above, notice the StyleCop activity in Codeplex Community TFS Build Extensions version seems to be built against StyleCop version and not

rfennell Aug 16, 2011 at 5:03 PM 
Some more notes on setting specific setting.stylecop within the build

elbruno Jul 10, 2011 at 1:58 PM 
Great info ! I performed some modifications and create a post in spanish. You can read it at