-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MSbuild on .NET Core can't parse properties with commas in the values #2999
Comments
Eugene hit this when trying to pass a parameter /p:ILLinkArgs="-h LdtokenTypeMethods,InstanceConstructors" |
Similar issue is #471 The workaround is to escape the surrounding quotes BTW, |
@kasper3 you're right, I was trying full framework MSBuild and that worked. dotnet msbuild has the same problem on Windows:
Updated title. My guess is that perhaps a bug has crept into the MSBuild command line parsing since the full framework MSBuild was last built, or perhaps it's something in the dotnet.exe parsing. |
Command line parsing is sadly different between .NET Core and full framework MSBuild, but there's another wrinkle in this case: shell escaping rules are very different on different platforms. raines@raines-z220u:~$ cat show-command-line.sh
#!/bin/sh
xargs -0 printf '%s\n' < /proc/$$/cmdline
raines@raines-z220u:~$ ./show-command-line.sh -foo "x" y="w,z" escaped=\"quotes\" 'singlequoted="doublquotes"'
/bin/sh
./show-command-line.sh
-foo
x
y=w,z
escaped="quotes"
singlequoted="doublquotes" Since the invoked process can't see the quotes, I don't think we can do better there. |
It's odd then that the same problem for some reason occurs on Windows. In your example case, you can still assume
|
Yeah, the problem is that the comma is syntactically relevant in a
So we're parsing the string in a reasonable way, but then splitting on the comma and complaining that you didn't provide a value for the Also and unimportant: if you specify |
Ha, I never realized a comma was valid there. So with quotes gone, you have to decide whether Neither are this case though -- there is only one Note I discovered a workaround; MSBuild escaping works here. Comma is %2c so
|
Another fix is dotnet/buildtools#1917. With "$@" in Unix shell, it preserves spaces as well as quotes, comma etc. |
@kasper3 I don't think that helps for comma/semicolon, because the problem isn't escaping the argument so that MSBuild gets it as a single string, but what we do with it after we have it. |
@danmosemsft Your this comment: |
Could you follow up under https://github.com/NuGet/docs.microsoft.com-nuget/issues/1948, please, with the definite syntax to pass multiple values to |
Steps to reproduce
This is on Ubuntu.
Expected behavior
It accepts
/p:a="b,c"
as defining a property nameda
with valueb,c
.Actual behavior
It errors as above . On Windows it works fine.
On Unix if I remove the comma and use a space it is fine:
Environment data
msbuild /version
output:OS info:
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
cc @erozenfeld
The text was updated successfully, but these errors were encountered: