Reputation: 71
I'm trying to create simple console app and debug it using vs code and c# extension. I have the following issue : When clicking debug button, error appears :
launch: launch.json must be configured. Change 'program' to the path to the executable file that you would like to debug
launch.json path to executable looks like that :
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
this file is autogenerated by VS Code, so what's wrong??? moreover, replacing previous path by full file system path like
Alex/bin/Debug/aspnetcore/projectname.dll"
makes it work. Please, help me, i haven't found anything, i just want to click the "start debugging" button and debug without any problems.
Best wishes, Aleksey
Upvotes: 1
Views: 1342
Reputation: 46
For anyone still hitting this issue:
Program.cs
file before starting to debug in Visual Studio Code.
.cs
file fires the C# extension.launch.json
and tasks.json
haven't already been added to the project.launch.json
and tasks.json
for you.For those interested there is an issue tracking this behavior.
Upvotes: 0
Reputation: 1081
You can leave ${workspaceRoot}
in, the issue is with <target-framework>
and <project-name.dll>
Here is an example that should work if you are running .NET Core 1.1:
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/projectname.dll",
That will get the project to debug on any machine since it is a relative path unless you rename the project. But the Visual Studio Code C# extension should not be auto generating a launch.json file that does not work.
I have opened a bug on this issue: https://github.com/OmniSharp/omnisharp-vscode/issues/1126
Upvotes: 4