我正在尝试在 VS Code 中调试一个简单的“Hello world”应用程序,但是,当我按 Ctrl + F5 时,它给了我以下错误:
如果我手动更改 launch.json 中的路径:
${workspaceFolder}/bin/Debug/insert-target-framework-here/insert-project-name-here.dll
至:
"${workspaceFolder}/bin/Debug/netcoreapp2.1/test.dll"
它确实有效,但是在没有我手动输入路径的情况下它可以正常工作之前。另外,我注意到 VS Code 不再像以前那样要求重建资产:
到目前为止,我已经尝试了以下方法:
卸载 VS Code,然后是 .NET Core 2.1,从 %USER%\.vscode\ 中删除 VS Code 扩展文件夹,重新安装 VS Code,然后是 .NET Core 2.1,然后是 C# 扩展(C# for Visual Studio Code(供电由 OmniSharp))。
当 VS Code 启动时,它确实成功下载了“OmniSharp”包,但是当我打开 C# 文件时,仍然没有提示重建资产。调试给出了与以前相同的问题。
这是launch.json:
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
}
还有tasks.json:
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet build",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}