From 89ae50d023d801027eb779d411885f310731ac3b Mon Sep 17 00:00:00 2001 From: Phillip Sharpe Date: Fri, 4 Dec 2015 12:26:34 +0000 Subject: [PATCH] Support spaces in MSBuild configuration --- .../Unit/Tools/MSBuild/MSBuildRunnerTests.cs | 11 ++++++----- src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs b/src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs index b38072a43d..232785f28c 100644 --- a/src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs @@ -587,19 +587,20 @@ public void Should_Append_Property_With_Multiple_Values_To_Process_Arguments() "\"/Working/src/Solution.sln\"", result.Args); } - [Fact] - public void Should_Append_Configuration_As_Property_To_Process_Arguments() + [Theory] + [InlineData("Release", "/m /v:normal /p:Configuration=\"Release\" /target:Build \"/Working/src/Solution.sln\"")] + [InlineData("Custom Spaced", "/m /v:normal /p:Configuration=\"Custom Spaced\" /target:Build \"/Working/src/Solution.sln\"")] + public void Should_Append_Configuration_As_Property_To_Process_Arguments(string configuration, string expected) { // Given var fixture = new MSBuildRunnerFixture(false); - fixture.Settings.SetConfiguration("Release"); + fixture.Settings.SetConfiguration(configuration); // When var result = fixture.Run(); // Then - Assert.Equal("/m /v:normal /p:Configuration=Release /target:Build " + - "\"/Working/src/Solution.sln\"", result.Args); + Assert.Equal(expected, result.Args); } [Theory] diff --git a/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs b/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs index f54b0c6975..7f67c91bc8 100644 --- a/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs +++ b/src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs @@ -61,8 +61,7 @@ private ProcessArgumentBuilder GetArguments(FilePath solution, MSBuildSettings s if (!string.IsNullOrWhiteSpace(settings.Configuration)) { // Add the configuration as a property. - var configuration = settings.Configuration; - builder.Append(string.Concat("/p:Configuration=", configuration)); + builder.AppendSwitchQuoted("/p:Configuration", "=", settings.Configuration); } // Build for a specific platform?