What are process parameters? These are the objects that we pass into the build process that determines what will be built, what tests to run (and how), and all the other switches that decide what happens.
How are they passed in? The process parameters can be set and/or modified in 3 different places. The XAML files (our process templates that are checked into version control under the BuildProcessTemplates folder) determine the types and names for the process parameters (they can be different for every process template). This is the first place you can set the value for a process parameter by specifying a default value for the process parameter within the XAML. When you create a definition you pick the build process template that it will use and so pick the process parameters that go with it. On the Process tab of the definition is where you can change the values of most process parameters for the second time. When you queue a build manually through the Queue Build dialog, you get your last chance to change the process parameters before the build starts.
What types are allowed for Process Parameters? As long as the type can be serialized by the XAML serializer (think Windows Workflow or WF), then you can use it as the type for a process parameter.
So, what do I mean by a custom process parameter? I just said that the process parameters are determined by the XAML. However, you can change the XAML :). So, let’s create our own process template and add a simple string process parameter and print it out in the XAML.
Create a “Hello World” build process template using a custom process parameter.
Here’s the XAML that I put into a file called HelloWorld.XAML:
<x:Property Name="MyProcessParameter" Type="InArgument(x:String)" />
<x:Property Name="Verbosity" Type="InArgument(mtbw:BuildVerbosity)" />
<x:Property Name="Metadata" Type="mtbw:ProcessParameterMetadataCollection" />
<x:Property Name="SupportedReasons" Type="mtbc:BuildReason" />
<mtbwa:WriteBuildMessage DisplayName="Write message" Message="[MyProcessParameter]" Importance="High" />
Notice that I left in some other process parameters (Verbosity, Metadata, and SupportedReasons). That’s because these parameters are special (not required, but special). We will talk more about them in future posts.
And here are the steps to making that XAML into a build process template and creating a definition for it:
When built the Log View shows what happened:
As you can see, adding a custom process parameter that is a simple type like String is fairly easy, but there is so much more you can do! Stay tuned for the next part!