vscode-csharp: launch.json The property 'program' is invalid for .dll file

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?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (15 by maintainers)

Most upvoted comments

well that’s embarrassing. Detritus from the placeholder and a “not seeing the trees for the forest” oversight when I was starting at the code for too long … so worried I had a typo in the path. After? LOL. And …I am now debugging aspnetcore right inside of VS Code! Hooray!!! Thanks.

I just now installed VS Code today and started a tutorial. When running F5 or Ctrl-F5 I was getting an error that the .dll was not valid. The fix was easy and was due to the default entry not having the full path. image image

See the same issue on Windows with following .NET CLI:

.NET Command Line Tools (1.0.0-rc2-002678)

Product Information:
 Version:     1.0.0-rc2-002678
 Commit Sha:  3b2ea9d14b

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64