Building multiple configurations and/or platforms in Build 2015

11 Jan, 2016
In XAML builds you could specify one or more configurations to build, if you left these values empty, the solution default would be built. Unless you were using a customized build template, each build|configuration pair would be built and tested in sequence.

The Build Agent will create a sub-folder for each Platform|Configuration if you specify multiple values.

In Build 2015, you can also build multiple configurations and/or platforms. And what’s pretty cool, if you have multiple build agents available, you can build and test these in parallel. If you have a single agent, or are using the Hosted build with the standard build minutes, it will build all combinations in sequence.

To build multiple platforms|configuration combinations, you should first define a variable to hold your Configuration and/or Platform:

And then you can use these variables in the MultiConfiguration option, which you can find on the build’s Options tab:

We’ve enabled the build definition to run a build for each permutation of these two variables. You can add more variables if you like, or only build multiple Configurations or only build multiple platforms by specifying the respective variable. It’s not possible to use multiple values without using a variable.

Your next step is to go over all your tasks in your build to ensure that the respective fields are configured. And if you’re staging or publishing artifacts, either make sure that your artifacts are uniquely named by including the build configuration and platform, or you’ll end up with one massive artifact with all your results.

On the Visual Studio Build task specify the Platform and Configuration parameters and use the same variables you used on your Variables page. The default values when using the Visual Studio Template will contain $(BuildConfiguration) and $(BuildPlatform):

Most standard steps have an option to specify the Configuration and Platform. Some feature this on the main configuration panel, some hide it, like the Visual Studio Test task:

When publishing artifacts, I prefer to ensure that the build configuration and/or platform is part of the artifact name, but you can also chose to create one massive package instead. This example creates one artifact for each platform:

Or a unique package for each unique combination:
Now that you tasks can handle multiple configurations, you can queue your build to see if it still works for just one. If that works, go to the variables page and specify the variable values you want to use, separate them using a comma:
And ow that your build definition successfully builds multiple configurations, you can go ahead and enable parallel builds to reduce the duration/feedback time of your build. You specify this as additional option on the Options page:
Concluding, you can build multiple configurations easily as you could with XAML builds. The only big change is that you cannot specify unique combinations of variables. Build 2015 will always build all permutations of the variables specified.
Jesse is a passionate trainer and coach, helping teams improve their productivity and quality all the while trying to keep work fun. He is a Professional Scrum Trainer (PST) through for the Professional Scrum Foundations (PSF), Professional Scrum Master (PSM) and Developer (PSD .NET) programs. With a strong background in the .NET platform and C#, Jesse is able to translate the needs of development teams when it comes to tools to manage work, build the code and keep quality up. He has contributed to a number of open source products that extend – as well as supported commercial tools like NDepend in their integration into – Team Foundation Server. Jesse regularly blogs and contributes to numerous communities on StackExchange and MSDN networks, he has received the Microsoft Community Contributor Award three years in a row and has been recently been awarded the Microsoft Most Valuable Professional award. He’s spoken at conferences and user groups, including the Microsoft TechDays and the Scrum Day Europe. Trainer certifications: Professional Scrum Foundations Professional Scrum Master Professional Scrum Developer (.NET) Scaled Professional Scrum (SPS) Scaled Agile Program Consultant In past years Jesse has delivered ALM, Test Automation and Scrum training all over the world, most recently in Sydney, Milan and Bangalore. He has redelivered materials from industry leading partners as well as developed his own. In addition to the previously mentioned subjects Jesse has taught courses on Visual Studio, Object Oriented Analysis and Design, Design Patterns for C# developers, Unified Modelling languages and Regular Expressions. Jesse is married with Charlotte, recently became father of his first daughter and lives in a house that’s more than a century old in the beautiful city of Utrecht. He loves espresso and dark chocolate, travels a lot and takes photos everywhere he goes.

Explore related posts