Multiple values passed to WithProperty are overridden
- Dominant language
- C#
- Stars
- 4.2k
- Forks
- 778
- Avg merge
- 1h 15m
- Merged PRs (30d)
- 19
Description
### What You Are Seeing?
MSBuildSettingsExtensions.WithProperty(MSBuildSettings, string, String[]) does not work as intended for multiple values of some properties (Maybe all, I don't know). Each value seems to overwrite, so only the last supplied parameter will be applied.
Calling .WithProperty("WarningsNotAsErrors", "1573", "1591") results in /warnaserror-:1591
It looks like method which is used to parse the property dictionary inside MSBuildRunner:
```
private static IEnumerable GetPropertyArguments(IDictionary> properties)
{
foreach (var propertyKey in properties.Keys)
{
foreach (var propertyValue in properties[propertyKey])
{
yield return string.Concat("/p:", propertyKey, "=", propertyValue);
}
}
}
```
Will return "/p:WarningsNotAsErrors=1573", "/p:WarningsNotAsErrors=1591". Which may override when applied sequentially.
Possibly the method could be amended to
```
private static IEnumerable GetPropertyArguments(IDictionary> properties)
{
foreach (var propertyKey in properties.Keys)
{
var values = string.Join(",", properties[propertyKey]);
yield return string.Concat("/p:", propertyKey, "=", values);
}
}
```
Which would return "/p:WarningsNotAsErrors=1573,1591". I'm not sure how this would affect other properties that are used, if a switch must be declared multiple times with single values it would break that.
### What is Expected?
Calling .WithProperty("WarningsNotAsErrors", "1573", "1591") would then become /warnaserror-:1573,1591 when run.
### What version of Cake are you using?
0.14.0.0
### Are you running on a 32 or 64 bit system?
64
### What environment are you running on? Windows? Linux? Mac?
Windows 7
### Are you running on a CI Server? If so, which one?
No, running from powershell script locally
### How Did You Get This To Happen? (Steps to Reproduce)
Add .WithProperty("WarningsNotAsErrors", "1573", "1591") to any MSBuildSettings.
Run in Diagnostic.
Check the value sent to CoreCompile vs the Executing line.
### Output Log
Run with -Mono and -Experimental:
[log.txt](https://github.com/cake-build/cake/files/380631/log.txt)
Contributor guide
Assessment
This issue has not been assessed yet.