vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Unable to configure commandline args with help

Open richlander opened this issue 1 year ago • 4 comments

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.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "coreclr",
            "request": "launch",
            "name": "Debug MyApp",
            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/MyApp.dll",
            "args": ["arg1", "arg2", "arg3"]
        }
    ]
}

Prompt: "how do I specify command line arguments in vs code launch.json for C#?"

richlander avatar Feb 23 '24 00:02 richlander

@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 recommended way to do this is with launchSetting.json rather than launch.json, though we don't currently have a great gesture to set this up :(
  2. The copilot-generated example, is not great -- I hope your app isn't targeting .NET Core 3.1, and it doesn't have a build task
  3. If you do want to generate a launch.json and you have Dev Kit installed, the best way to do so is by running '.NET: Generate Assets for Build and Debug' from the command pallet. I think we should at least add a 'Setting up launch.json' section to the top of https://code.visualstudio.com/docs/csharp/debugger-settings with this information.

gregg-miskelly avatar Feb 23 '24 19:02 gregg-miskelly