【发布时间】:2016-09-04 16:41:13
【问题描述】:
1. 设置:我已经在我的 Ubuntu 上安装了 Visual Studio 代码,并安装了 .NET Core 和 Mono。
2. 初始配置:我创建了一个运行notnet restore 和dotnet run 的简单演示应用程序。这可以正常工作并显示“Hello World!”在终端上。
3. 扩展:为了调试它,我安装了 OmniSharp 的扩展。然后使用 Visual Studio Code 的“调试器”选项,我添加了 launch.json 和 task.json。
4. launch.json(只显示配置部分):
....
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netstandardapp1.5/hwAppCore2.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
}
....
5. 现在,从终端运行时它工作正常,但是当尝试使用选项 .NET Core Launch (console) 进行调试时,我收到以下错误:
"launch: 'program' 属性无效。'/home/ak/dotnet_core/hwAppCore2/bin/Debug/netstandardapp1.5/hwAppCore2.dll' 是库 (.dll),不是程序。”
我也关注了Channel 9 demo 之一,我还可以看到为 launch.json
的程序属性配置的 hwapp.dll我不确定,我是否缺少要配置的内容?
【问题讨论】:
-
您应该使用参数
run <path to dll>启动dotnet -
我可以使用
dotnet run从终端正确运行我的应用程序,但是我遇到了来自 vscode 的调试选项问题。 -
我将launch.json的程序属性中的路径更新为“程序”:“${workspaceRoot}/bin/Debug/netstandardapp1.5/ubuntu.14.04-x64/hwAppCore2”-(添加文件夹ubuntu.14.04-x64 并删除 .dll) 并正确启动调试。这是正确的方法吗?
标签: visual-studio-code .net-core omnisharp