Skip to content

Debug multiple ASP.NET Core projects in Visual Studio Code #1441

@alexdima

Description

@alexdima

Moved from microsoft/vscode#25628
From @mdmoura


  • VSCode Version: 1.11.2
  • OS Version: Windows 10

I have the following ASP.NET Core solution (solution.sln) structure in VS Code:

.vscode
  launch.json
  tasks.json
src/
  api/
    api.csproj
  web/
    web.csproj
test/
  api.test/
    api.test.csproj    
solution.sln

I need to debug both api.csproj and web.csproj so I added the launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Api",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build",
      "program": "${workspaceRoot}/src/api/bin/Debug/netcoreapp1.1/api.dll",
      "args": [],
      "cwd": "${workspaceRoot}/src/api",
      "stopAtEntry": false,
      "console": "internalConsole"
    },
    {
      "name": "Web",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build",
      "program": "${workspaceRoot}/src/web/bin/Debug/netcoreapp1.1/Nupaya.Api.dll",
      "args": [],
      "cwd": "${workspaceRoot}/src/web",
      "stopAtEntry": false,
      "launchBrowser": {
        "enabled": true,
        "args": "${auto-detect-url}",
        "windows": {
          "command": "cmd.exe",
          "args": "/C start ${auto-detect-url}"
        },
        "osx": {
          "command": "open"
        },
        "linux": {
          "command": "xdg-open"
        }
      },
      "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "sourceFileMap": {
        "/Views": "${workspaceRoot}/src/api/views"
      }
    }
  ]
} 

And the following tasks.json:

{
  "version": "0.1.0",
  "command": "dotnet",
  "isShellCommand": true,
  "args": [],
  "tasks": [
    {
      "taskName": "build",
      "args": ["Api", "Web"],
      "isBuildCommand": true,
      "showOutput": "always",
      "problemMatcher": "$msCompile"
    }
  ]
}  

But when I debug it I get the following error:

MSBUILD : error MSB1008: Only one project can be specified.

I have tried different options but I always end with some kind of error some not even related with MSBUILD.

What is the proper way to debug multiple ASP.NET CORE projects in Visual Studio Code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions