场景:
我正在尝试在 Sabayon Linux 下的 Visual Studio Code 上调试 asp.net 核心项目。当我按 F5 时,我收到以下消息:
Run 'Debug: Download .NET Core Debugger' in the Command Palette or open a .NET project directory to download the .NET Core Debugger
打开命令面板并选择“调试:下载 .NET Core 调试器”什么都不做。
软件版本:
Sabayon Linux 16.07
dotnet --version 1.0.0-preview2-003121
Visual Studio Code 1.4.0
VSC 1.3 的 C# 扩展
启动.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/myproject.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"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}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
最佳答案
BugFinder的评论帮助我在 Debian 9 下的 Visual Studio Code 上解决了同样的问题:
- 删除位于 ~/.vscode/extensions/ms-vscode.csharp- 的整个 csharp 扩展目录,然后重新安装最新版本的 C# 扩展
- 在输出面板(查看 -> 切换输出)中查看调试器安装状态并选择“Razor 日志”选项
- 修复那里发现的所有可能问题(对我来说,缺少“libunwind8”依赖项,实际修复是运行“sudo apt-get install libunwind8”)
- 重启 Visual Studio Code
关于c# - 无法在 Visual Studio Code 上启动 C# 调试器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38991315/