-
-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple values passed to WithProperty are overridden #1106
Comments
Are we sure that all of the other MSBuild options also support the "comma delimited values with a single key" format that WarningsNotAsErrors does? Because the |
Unfortunately I can't even find documentation confirming that duplicate /property assigns to the same key will overwrite, I'm just inferring from results. I've looked through the msbuild switches, compiler options and common build parameters. In most cases it's comma or semicolon delimitation, but in some it's only comma, and some only semicolon. As a change is not really viable, possibly another method could be added to account for comma delimited properties?
It would let GetPropertyArguments function the same, while dealing with the comma delimited case. |
This will need to be investigated, we could probably step thru the MSBuild source and see what it does. If someone wants to contribute / do the work I'll happily review a PR. |
HI @devlead, i have step thru MSBuild sources and it seems that they support either comma's or semicolons (
|
And as you see here, duplicate properties are always will overwrite. |
@devlead: confirming what @martinscholz83 and @nickmacd found is still valid.
In total Cake's current handling for multiple parameters in the "MSBuildSettingsExtensions.WithProperty" method basically results in MSBuild discarding everything except the last parameter. As this definitely doesn't seem to be the intended behavior I would consider this a bug that should be fixed, even though it might change the behavior of old scripts that tried to use multiple parameters (but didn't actually). |
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:
Will return "/p:WarningsNotAsErrors=1573", "/p:WarningsNotAsErrors=1591". Which may override when applied sequentially.
Possibly the method could be amended to
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
The text was updated successfully, but these errors were encountered: