launch.json: default value and help text for 'program' is confusing
Environment data
dotnet --info output: 2.0.0-preview2-006497
VS Code version: 1.14.2
C# Extension version: 1.11.0
Steps to reproduce
Generate and open a new dotnet core project Select .NET Core as debugging environment Select .NET Core tasks
~~tasks.json contains "command": "dotnet",, however since task versions 2.0.0 the task name does not get appended automatically, so by default it should be "command": "dotnet build",~~ (coming directly from VS Code)
launch.json contains "program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",, however according to the tooltip (which shows <project-name>, containing a backslash) it should be <project-name>.dll instead of <project-name.dll>.
However even when using <project-name.dll> debugging is not working, one needs to manually replace both placeholders (the tooltip mentions that the project.json file, not the .csproj file, gets read).
This is an issue with the tasks.json template which is in VS Code. So closing this issue.
The first part of my issue is an issue within VS Code, but the second one (launch.json) gets generated by this extension (https://github.com/OmniSharp/omnisharp-vscode/blob/master/src/tools/OptionsSchema.json).
Ah, am I correct that it was never intended to automatically replace <target-framework> and <project-name> by their according values and that one has to replace them manually?
Correct
Oh, then sorry. Maybe it would be useful to state it more clearly in the description (I always thought that is a bug). Would it be that hard to automatically fetch the used framework and project name or at least automatically replace it when creating the launch configuration?
We do that. But we can't plugged the vscode templating system that way. To have the C# extension generate things nicely, follow the instructions.
Thank you for the information (to me it was never quite clear that those assets are the task and launch jsons) and sorry for bothering you.
Its okay. Its good feedback that this is difficult. Is this more understandable:
Default value: "${workspaceRoot}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll"
Description: "Path to the application dll or .NET Core host executable to launch. Example: '${workspaceRoot}/bin/Debug/netcoreapp1.1/MyProject.dll'
Where: 'netcoreapp1.1' is the target framework that the project is set to build. This is normally found in the project file as the 'TargetFramework' property. 'MyProject.dll': the name executable file that your project builds. This is normally the same as the project file name.",
In my opinion that would be definitely better.
Thanks. I will verify that actually displays well in our tool tips. If so, I will make it so.
One thing I noticed is that the - and dots in the description tooltip get displayed falsely escaped (\-, \.) when being within <...>, but that is an issue of VS Code and your example doesn't contain any hyphens:
I'm following the latest tutorial published on 07/07/2017 => Getting started with ASP.NET Core MVC on Mac, Linux, or Windows and I get similar errors with the launch and task.json files and the debugger does not work.
I have followed several threads on this topic and all I see is a lot finger pointing from one side to the next making the subject EVEN MORE CONFUSING. Somebody should publish a document with the UPDATED complete set of rules on how to use/debug/implement a .NET core app with VS-CODE and the rest of these GREAT technologies. IT'S ABOUT TIME. that's just my opinion... IMHO???
@dcu-sharepoint a closed issue is probably not the best place to discuss things, but we are happy to try and help if we can. For documentation about using C# with VS Code, your can start with the README for this repo, which has links to a bunch of other useful documents for using C# and VS Code.
If you have questions, or suggestions for improvements, please open a new issue and we are happy to try and help.
I had the same problem and I had to download the version that specified in the console error. And then follow the steps in this link.. make sure to open a new command prompt to execute the commands
https://www.microsoft.com/net/learn/get-started/windows
It is still confusing to understand how to configure the program in launch.json. I am still struggling. Would you mind explaining it ? Though I am just trying to run just a simple code... What I have written: "program": "${workspaceFolder}/bin/Debug/<netcoreapp5.0>/<E:/Code Scripts/Level.cs>",
It should be set to the path of your project's output executable. Example: ${workspaceRoot}/bin/Debug/net5.0/MyProject.dll.