1. Setup: I have installed Visual Studio code on My Ubuntu and installed .NET Core and Mono.
2. Intial Configuration: I created a simple demo app running notnet restore
and dotnet run
. This simply works fine and display "Hello World!" on terminal.
3. Extension: To debug this, I installed extension of OmniSharp. and then using "Debugger" option of Visual Studio Code, I added launch.json & task.json.
4. launch.json (Only showing configuration section):
....
"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. Now, when running from terminal it works fine, however when try to debug using option .NET Core Launch (console) I am getting following error:
"launch: The property 'program' is invalid. '/home/ak/dotnet_core/hwAppCore2/bin/Debug/netstandardapp1.5/hwAppCore2.dll' is a library (.dll), not a program."
I also followed one of Channel 9 demo, and there also I can see hwapp.dll configured for program property of launch.json
I am not sure, am I missing anything to configure?
There are several hoops you have to jump through to get VS Code debugging .NET Core websites. The relevant steps (from this blog post walkthrough) are:
.vscode > tasks.json
).vscode > launch.json
) with 3 configurations - "console", "web", and "attach".launch.json
file and edit the "web" configuration's program
value - replace the <>
placeholders with your specific values (e.g. netcoreapp1.0
and MyProject.dll
).
project.json
file - under buildOptions
, add "debugType" : "portable"
dotnet restore
on your project to get the latest packages