Repository: vscode
Issue: C# Dev Kit: None of the ShellQuoting values work in all cases to run dotnet build command using ShellExecution
Labels: bug,tasks

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: The issue is encountered by an extension, but the root cause is within the VS Code implementation

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.80.0
- OS Version: Windows 11

Steps to Reproduce:
C# Dev Kit Extension uses a task to run the "dotnet build <pathtocsproj>" in order to build a particular project using code like this:

```ts
const shellQuotedFilePath: vscode.ShellQuotedString = { value: filePath, quoting: vscode.ShellQuoting.Escape }
	const args: (string | vscode.ShellQuotedString)[] =
		["build", shellQuotedFilePath, '/property:GenerateFullPaths=true', '/consoleloggerparameters:NoSummary']

	const execution = new vscode.ShellExecution('dotnet', args)

	const task = new vscode.Task(kind, scope, taskName, 'dotnet', execution)
```
The issue we are running into is that none of the supported values of [ShellQuoting](https://code.visualstudio.com/api/references/vscode-api#ShellQuotingOptions) work in all scenarios:

## Not specified
Fails if path contains a parenthesis.

(More info internal DevDiv bug 1813506)
## `Weak`
I don't remember details about Weak but we didn't use it, I think it wasn't strong enough and wasn't handling some common cases correctly

## `Strong`
It doesn't work when the path has multiple consecutive spaces, it appears that PowerShell consolidates them into a single space resulting in invalid path so the build command fails because the path with single space doesn't exist
`foo  bar.csproj` -> `foo bar.csproj`

(More info internal DevDiv bug 1828709)

## `Escape`
It doesn't work if the default terminal is cmd (this is the current behavior).

https://github.com/microsoft/vscode-dotnettools/issues/237

So, we tried all the possible options, but none of them work in all cases.
So what should we do? Should we add the quotes ourselves? Should we skip completely the shell integration part?

To repro these issues:
1. Install the C# Dev Kit extension (latest pre-release)
2. Create a new folder that contains a space in the name
3. Create a new class library
4. Change the default terminal to be cmd
5. In the solution explorer, right click on the project -> Build