'VSCode .NET Core Debugging seems to ignore working directory

Recently, debugging has broken for my ASP.NET Core, C# solution.

VSCode 1.65.0 and C# extension v1.24.1

I get this message.

> Executing task in folder src: dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary <

Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
The terminal process "/bin/zsh '-c', 'dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

The debugger configuration selector looks like this:

VSCode debugger configuration selector UI

I am trying to run the ticked item, i.e. "Debug TZ Naked (src)" - note that TZ is a code for my app and "naked" means not-in-Docker.

The configuration looks like this:

{
    "name": "Debug TZ Naked",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/AcmeCorp.CoyoteApp.AspNetCoreMvc/bin/Debug/net6.0/AcmeCorp.CoyoteApp.AspNetCoreMvc.dll",
    "args": [],
    "cwd": "${workspaceFolder}/AcmeCorp.CoyoteApp.AspNetCoreMvc",
    "stopAtEntry": false,
    "internalConsoleOptions": "openOnSessionStart",
    "launchBrowser": {
        "enabled": true,
        "args": "${auto-detect-url}",
        "windows": {
            "command": "cmd.exe",
            "args": "/C start ${auto-detect-url}"
        },
        "osx": {
            "command": "open",
            "args": "https://localhost:44340"
        },
        "linux": {
            "command": "xdg-open"
        }
    },
    "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
    },
    "sourceFileMap": {
        "/Views": "${workspaceFolder}/Views"
    }
},

Note that the cwd key is set to the correct value, as is relative to my workspace. I've not renamed any folders or moved my workspace for months.

I have a build task here:

    {
        "label": "build",
        "type": "process",
        "command": "dotnet",
        "options": {
            "cwd": "${workspaceFolder}/AcmeCorp.CoyoteApp.AspNetCoreMvc"
        },
        "args": [
            "build",
            "${workspaceFolder}/AcmeCorp.CoyoteApp.AspNetCoreMvc/AcmeCorp.CoyoteApp.AspNetCoreMvc.csproj"
        ],
        "problemMatcher": "$msCompile"
    },

I'm not sure why it's stopped working. I've restarted VSCode just in case, and I've switch the working directory of open terminals to no avail.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source