-
Notifications
You must be signed in to change notification settings - Fork 588
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.build generates an incorrect command line (FAKE 5) #2112
Comments
From a command line escaping perspective there should be no difference between using the quotes after or before |
It seems the problem is caused by the comma ",1433" |
If i write this command in terminal, and the comma ',1433' is removed, it does not work but it does not complain. If the comma is there, it complains. If the /p: is outside the quotes, it works fine. |
maybe comma is a special syntax to start another argument in msbuild and there need to be additional quotes around the property value, no idea |
By the way I think one workaround is to use environment variables instead of cli arguments. I think even dotnet cli is doing that for some stuff as there are dome edge cases impossible to escape properly |
Dunno how to do that with env vars. |
The workaround is working fine
|
maybe @vbfox has an idea what's going on there? |
@softlion Are you sure your workaround is doing what you want? I just tried to reproduce this with: <Project>
<Target Name="Test">
<Message Importance="high" Text="Prop: $(MyProp)" />
</Target>
</Project>
And the other escaping indeed leads to the error you did report. |
It seems with comma you can assign multiple properties with a single <Project>
<Target Name="Test">
<Message Importance="high" Text="$Prop: $(MyProp)" />
<Message Importance="high" Text="$Other: $(Other)" />
</Target>
</Project>
|
Yes the msbuild command is running fine when /p: is outside the double quotes. If it is inside, even if i remove the comma of ,1433 it does not work. Either with a message, or with no message at all (which is strange). I copy/pasted the command manually to verify while creating the workaround. |
Ok I think I figured it out: dotnet/msbuild#2999 The correct thing to to is to use: (ie set the "value" of the properties in quotes as well) However, we need to figure out how msbuild expectes escaping there |
I think we will just add msbuild escaping here https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-special-characters?view=vs-2017 (including comma) from my quick tests that seems to work the best |
@softlion Should be fixed in the next release, thanks for reporting |
Description
The following script part generates a command line which fails, because the /p switch is inside a string:
Generates this command line, which fails:
Repro steps
see above.
Expected behavior
no fail.
Actual behavior
Known workarounds
A command which works would be the following one. The only difference is the quote.
/p:"target=..." instead of "/p:target=..."
Related information
The text was updated successfully, but these errors were encountered: