I am trying to compile c# code on windows 7 using visual studio code. I have all the extensions downloaded but am getting this error:
launch: program 'launch: launch.json must be configured. Change 'program' to the path to the executable file that you would like to debug.
I can not figure out how to fix it. This is the line which I believe needs to be changed in the launch.json file, this is what is currently there:
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/exam 1.dll"
(exam 1 because that is the name of my .cs file containing my C# code)
When I go into the folder where my .cs file is, this is the whole path:
- "C:\Users\Kdrumz\Desktop\ObjectOriented\exam 1.cs".
I am very confused. Also, will I always have to do this when using visual studio code? Any help is greatly appreciated!
Using version 1.7.1 of visual studio code
I fixed it by replacing all the "<>"-styled values in
launch.json
like this (the project is named 'sample01' in my case):As you can see, I only use 1 configuration which is named ".NET Core Launch (console)". This name can be changed and you'll see it when you click on the debug-menu on the far left (the one with the bug-symbol) and take a look at the very top.
Now I entered the complete path of my build-config (which is .NET Core 1.0 in my sample) and it works.
So yes, you would have to do it manually if it is preconfigured with "<>"-elements. If you use
dotnet new
and thencode .
to bring up new projects the newer versions of Visual Studio Code will create ready-to-runlaunch.json
now.1) Open your project directory/folder in Explorer (windows) or Finder (Mac).
2) Go to
bin/Debug/netcoreapp{version}/{projectName}.dll
and make sure you copy the absolute and complete path of the main project DLL and put it as a value to allprogram
elements inside yourlaunch.json
.Make sure to change all program elements in all sections in launch.json (console/web)
For anyone still hitting this issue:
Program.cs
file before starting to debug..cs
file fires the C# extension.launch.json
andtasks.json
haven't already been added to the project.launch.json
andtasks.json
for you.For those interested there is an issue tracking this behavior.