How to build multiple configurations in a single VSTS build

Problem:

When I try to build debug and release at the same time I get the following error:

The specified solution configuration "release, debug|any cpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

Solution:

Enable the Multi-configuration option.

image

Explanation:

By default the Multi-configuration option is disabled. To build multiple configurations at once, you actually have to do more than just check the box. First you need to update the BuildConfiguration variable to a comma-delimited string of configurations.

  1. Select the build
  2. Click the Edit link
  3. Click the Variables tab
    Field Value
    BuildConfiguration release,debug

    image

With the build configuration updated, you can now enable the Multi-configuration option.

  1. Click the Options tab
  2. Check the Multi-configuration checkbox
    Field Value
    Multipliers BuildConfiguration
  3. Click Save

Now when you queue a new build, both configurations will build.

image

Comments (7) -

  • Thank you! Your post here helped me after about a week of testing and searching for the correct way to build multiple configurations.
  • Donovan, is it possible to build multiple configurations in a single queue?
    For now another builds wedged between each configuration and Multi-configuration build takes a long time.
  • Hello, Donovan!
    Is it possible to make Multi-configuration build in a single queue?
    For now another builds wedged between building each configuration and Multi-configuration build takes a long time.
    • If you only have a single agent in your queue each build will happen one after the other.  If your builds to happen at the same time you must have multiple agents in your queue.  
  • Quick question. If I have a release and debug version of a website, how do you stop it from building into the same zip, etc?
    • Change MSBuild Arguments from:
      /peployOnBuild=true /p:WebPublishMethod=Package /packageAsSingleFile=true /p:SkipInvalidConfigurations=true /packageLocation="$(build.artifactstagingdirectory)\\"

      To
      /peployOnBuild=true /p:WebPublishMethod=Package /packageAsSingleFile=true /p:SkipInvalidConfigurations=true /packageLocation="$(build.artifactstagingdirectory)\\$(BuildConfiguration)\\"

      By adding $(BuildConfiguration) each config will get a different zip.

Add comment

Loading