How to add an enum to a TFS build definition

Recently I was asked how you go about to create an enum/drow-down argument in a TFS build definition. It’s actually a quite easy thing to solve and requires very little code. But it does require a fair bit of plumbing and since I didn’t find an example on how to do this I’m posting the steps here.

This is the scenario: I want a drop-down argument in my build definition that’s bound to an enum value, i.e. let me select the build status from a known set of values:


First add an enum to a TFS build activity:


I’m assuming you’re familiar with the process of TFS build extensibility. If you need an example of how to create a TFS build activity see for an example.

Next add an argument of the BuildStatusEnum type to your build definition:


To get the enum to show as drop-down you need to add metadata to render it correctly. Open the metadata editor in from the Metadata argument and add the BuildStatus argument as a parameter. Then specify Microsoft.TeamFoundation.Build.Controls.EnumPropertyEditor, Microsoft.TeamFoundation.Build.Controls as the Editor, this does the trick of rendering the enum as a drop-down in the build definition process later on. The EnumPropertyEditor is one of the built-in editors which is convenient to use instead of implementing this logic yourself. If you’re curious of what other editors there are then take a look at this post and dig deeper by using a .NET reflection tool to investigate the code.


That’s all you need to do to setup the design time experience, now you can go on and use the enum in the build definition as you intend to.


WitCustomControls for 2013 Update 2 released

We’ve added a release at to fix an issue caused by changes in the jscript structure in TFS 2013 Update 2.

Release Notes

This release contains the following changes:

Download the latest release here:

Presentation från “Har du en DevOps i ditt team?” (SWE)

Tack alla som kom, bra diskussioner om ett i mitt tycke viktigt ämne!

Nu finns presentation från seminariet uppe på SlideShare:

Nästa gång kör vi i Göteborg (den 12 september). Passa på att boka dig om du vill komma och lära dig mer om DevOps rollen och hur Visual Studio 2013 ALM hjälper dig bli mer effektiv i teamet. Info och registrering på