title: How to queue another TFS (2012) Build from a TFS Build AND pass process parameters?
body: <p>The product I work on comprises 3/4 seperate (non-dependant) TFS builds.</p>
  
  <p>I would like to create a single TFS build which queues the other 3/4 builds from within the ProcessTemplate AND, critically, pass process parameters to them.  This build would wait for them all to complete and return an overall success/failure of the build.</p>
  
  <p>So my questions are:</p>
  
  <ul>
  <li>Can this be achieved by any existing 'standard' Workflow activities (my manager has had bad experiences with custom workflow activities)?</li>
  <li>If not, I am able to 'shell out' to powershell.  Can I achieve what I want from within Powershell (accessing the API)?</li>
  <li>Maybe using TFSBuild.exe?  But I can't find a way of passing the custom process parameters I need.</li>
  </ul>
  
  <p>Any assistance or guidance would be appreciated.</p>
  
  <p><strong>UPDATE</strong>
  The following powershell script will execute the build, but I'm still at a loss to be able to pass my custom process parameters :-(</p>
  
  <pre><code>function Get-BuildServer
  {
      param($serverName = $(throw 'please specify a TFS server name'))
      [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
      [void][System.Reflection.Assembly]::LoadWithPartialName    ("Microsoft.TeamFoundation.Build.Client")
      $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName)
  
      return $tfs.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
  }
  
  $buildserver = Get-BuildServer "http://tfsserver:8080/tfs/My%20Project%20Collection"
  $teamProject = "ESI"
  $buildDefinition = "iPrl_BuildMaster"
  $definition = $buildserver.GetBuildDefinition($teamProject, $buildDefinition)
  $request = $definition.CreateBuildRequest()
  $buildserver.QueueBuild($request, "None") 
  </code></pre>
  
  <p>Now after googling, I have found the following C# code to update the verbosity and, assuming it's the same for my custom process parameters, I need to convert this to work with the above powershell script.  Any ideas?</p>
  
  <pre><code>IDictionary&lt;String, Object&gt; paramValues = WorkflowHelpers.DeserializeProcessParameters(processParameters);
  paramValues[ProcessParameterMetadata.StandardParameterNames.Verbosity] = buildVerbosity;
  return WorkflowHelpers.SerializeProcessParameters(paramValues);
  </code></pre>