Skip to content

Commit

Permalink
changed msbuild's withProperty to forward multiple parameters as a co…
Browse files Browse the repository at this point in the history
…mma separated list
  • Loading branch information
Markus authored and devlead committed Mar 22, 2019
1 parent 850bdce commit 95e2547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ public void Should_Append_Property_With_Multiple_Values_To_Process_Arguments()
var result = fixture.Run();

// Then
Assert.Equal("/v:normal /p:A=B /p:A=E /p:C=D /target:Build " +
Assert.Equal("/v:normal /p:A=\"B,E\" /p:C=D /target:Build " +
"\"C:/Working/src/Solution.sln\"", result.Args);
}

Expand Down
9 changes: 7 additions & 2 deletions src/Cake.Common/Tools/MSBuild/MSBuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,14 @@ private static IEnumerable<string> GetPropertyArguments(IDictionary<string, ILis
{
foreach (var propertyKey in properties.Keys)
{
foreach (var propertyValue in properties[propertyKey])
if (properties[propertyKey].Count > 1)
{
yield return string.Concat("/p:", propertyKey, "=", propertyValue.EscapeMSBuildPropertySpecialCharacters());
var commaSeparatedValues = string.Join(",", properties[propertyKey].Select(x => x.EscapeMSBuildPropertySpecialCharacters()));
yield return string.Concat("/p:", propertyKey, "=", '"', commaSeparatedValues, '"');
}
else if (properties[propertyKey].Count == 1)
{
yield return string.Concat("/p:", propertyKey, "=", properties[propertyKey].First().EscapeMSBuildPropertySpecialCharacters());
}
}
}
Expand Down

0 comments on commit 95e2547

Please sign in to comment.