Deserializing Process Parameters

Team Foundation Build 2010 allows each build process template to expose its own parameters to the build definition editor as well as to the person queuing the build. When using the API it can be confusing to see that these parameters are stored as a string on the IBuildDefinition interface rather than a dictionary or some other data type. These parameters are actually serialized as XAML and stored with the build definition, but there is a helper class in Microsoft.TeamFoundation.Build.Workflow (which typically lives in %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies) called WorkflowHelpers which has a method called DeserializeProcessParameters which will convert this string into a dictionary of parameter name and the value that’s been specified in the build definition editor.

Here is an example of how to use this:

var tpcUrl = new Uri(args[0]);

var teamProjectName = args[1];

var buildDefinitionName = args[2];


var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tpcUrl, new UICredentialsProvider());

var buildServer = tpc.GetService<IBuildServer>();

var buildDefinition = buildServer.GetBuildDefinition(teamProjectName, buildDefinitionName);

var processParameters = WorkflowHelpers.DeserializeProcessParameters(buildDefinition.ProcessParameters);


foreach (var parameter in processParameters)


Console.WriteLine("Parameter: {0}", parameter.Key);

       Console.WriteLine("\t{0}", parameter.Value);



Comments (3)

  1. Edi says:


         Interesting blog post. I can't seem to figure out why I would want to use this functionality. Can you give us a better richer example of it's real world use, or were you just documenting the API?

  2. Giulio says:

    This is extremely useful when you create/queue builds through script (I use Powershell as an example)

  3. sai says:

    can we update parameter.Value which can update build definition ?

Skip to main content