Skip to content

Commit

Permalink
Support spaces in MSBuild configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SharpeRAD committed Dec 4, 2015
1 parent d4a3a4c commit 89ae50d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/Cake.Common.Tests/Unit/Tools/MSBuild/MSBuildRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 89ae50d

Please sign in to comment.