Peter Andersson
Peter Andersson

Reputation: 2047

Debugging ASP.NET Web App on VS Code Linux doesnt work

I'm testing out ASP.NET Core using this tutorial: https://www.blinkingcaret.com/2018/03/20/net-core-linux/

When building and running from the terminal, both the CLI and Web app works fine:

Web app:

dotnet run
Using launch settings from /home/peter/Documents/dotnet_linux/Reminders.Web/Properties/launchSettings.json...
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
    User profile is available. Using '/home/peter/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Development
Content root path: /home/peter/Documents/dotnet_linux/Reminders.Web
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

However from VS Code 1.28.1 I can only run the CLI app. When I add a configuration for the web app:

{
    // Use IntelliSense to find out which attributes exist for C# debugging
    // Use hover for the description of the existing attributes
    // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll>",
            "args": [],
            "cwd": "${workspaceFolder}/Reminders.Web/bin/Debug",
            "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": "${workspaceFolder}/Views"
            }
        },
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/Reminders.Cli/bin/Debug/netcoreapp2.1/Reminders.Cli.dll",
            "args": [],
            "cwd": "${workspaceFolder}/Reminders.Cli",
            // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
            "console": "internalConsole",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart"
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        },
    ]
}

I get the error

enter image description here

This DLL does indeed exist.

I have looked through all config options for launch.json here: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md but not found anything

Upvotes: 0

Views: 343

Answers (1)

mason
mason

Reputation: 32694

You have an extra angle bracket.

Change

"program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll>",

to

 "program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll",

Upvotes: 1

Related Questions