Building multiple configurations and/or platforms in Build 2015

2016-01-11

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.
 

Search This Blog

Loading...

Most Reading

Archives