-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Task with escaped double quote now fails due to improper evaluation #50131
Comments
@kevinbeaudoin actually shell tasks with args quoting and spaces were poorly supported and there should have been an warning / error in the task output informing that if a shell task specifies args with spaces they should be folded into the command. I apologies if this didn't happen in your case (but I am confident it did looking at your example). (side note: the reason for this is that shell take a command line as arguments and not a command and args and VS Code always tried to create a command line from the command and the args but did a poor job on doing this correctly in the past) To make the story better we improved the quoting/escaping behavior in
For complex command lines where only parts inside the command line should be quoted the recommendation is to write one single command line. In our example something like: "command": "msbuild ${workspaceRoot}....\MySolutionName.sln /property:Configuration=Debug /property:platform="Any CPU" /v:m /p:WarningLevel=0" since this gives you the biggest control over the command. Since users uses args to split the long command line into lines I added support to provide a string[] for a command for the next release: So with "command": [ Noticed that there are no args. You construct a command line. On think I take away from this is that for args we should off a "leave as is" quoting rule which leaves the args untouched even if it has spaces. I will add that. |
My last sentence is not correct. The fix here is to detect that "Any CPU" is quoted and leave it untouched. |
I added a fix to detect that |
To verify write a simple task that has a space in one of the args which is correctly quoted. Something like
The executed command should be |
We are using custom task in vscode to compile some C# solutions using msbuild. The tasks used to run just fine but with latest upgrade our task now fails because double quote escaping isn't performed correctly (see example below)
Steps to Reproduce:
Create a task similar to this one (Notice the quote escape for the Any CPU param):
{
"label": "Build MySolutionName.sln",
"type": "shell",
"command": "msbuild",
"isBackground": false,
"options": {
"cwd": "C:\Program Files (x86)\MSBuild\14.0\Bin"
},
"args": [
"${workspaceRoot}\..\..\MySolutionName.sln",
"/property:Configuration=Debug",
"/property:platform="Any CPU"",
"/v:m",
"/p:WarningLevel=0"
],
"group": "build",
"problemMatcher": []
},
Here is the task that vscode tries to run (Notice the issue with the part where we specify the Any CPU :
Executing task: msbuild MySolutionName.sln /property:Configuration=Debug "/property:platform="Any CPU"" /v:m /p:WarningLevel=0
Before the upgrade the task was run like below:
Executing task: msbuild MySolutionName.sln /property:Configuration=Debug /property:platform="Any CPU" /v:m /p:WarningLevel=0
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: