Open richlander opened 6 months ago
@richlander was the issue that you didn't have a launch.json starting point? Or that the docs don't really spell out an example?
FYI --
+1 the docs and instructions on this are not clear. For example the docs page linked by Richard says:
With C# Dev Kit, you can bring your launchSettings.json from Visual Studio to work with Visual Studio Code
Okay, but where does that launchSettings.json configuration file go? ${workspaceFilder}/Properties/launchSettings.json
? Or maybe ${workspaceFolder}/${PATH_TO_PROJECT_FOLDER}/Properties/launchSettings.json
?
The docs page will show config snippets (e.g. launchbut often omit where that snippet needs to go, which is important when we're talking about 3 different config files. For example:
To configure which launchSettings.json profile to use (or to prevent it from being used), set the launchSettingsProfile option:
"launchSettingsProfile": "ProfileNameGoesHere"
So launchSettingsProfile
is a member of the debug configuration entry under launch.json
, or a property at the top-level of launchSettings.json
to select which of its member profiles to use?
In addition, the experience for generation launch configurations is confusing and the new approach seems undocumented.
The docs appear to reference the older coreclr
type launch configuration but if I go into launch.json
myself and click "Add configuration..." and then select "C#", it adds a new dotnet
configuration centered around a csproj file:
{
"name": "C#: <project-name> Debug",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/<relative-path-to-project-folder><project-name>.csproj"
},
No more hardcoding of DLL paths! Excellent. Not so excellent is apparently all the other usual config parameters like env
, cwd
, args
, etc are gone and no longer work. Trying to pick a launch settings profile name or settings location also fails.
There's also the new Dynamic Configurations which work great but they use a launchConfigurationId
property whose syntax I can't seem to find documented anywhere. It also appears to have no effect; launchSettings.json
is entirely ignored and the syntax in launchConfigurationId
doesn't change the executed debug server (which I verified by setting the console to external terminal).
I was unable to figure out how to enable command line args using this page: https://code.visualstudio.com/docs/csharp/debugger-settings
I asked Bing Copilot and it gave me the answer I wanted with copy/paste syntax right away. It gave me a helpful explanation, plus the following JSON.
Prompt: "how do I specify command line arguments in vs code launch.json for C#?"