Skip to content

.NET Script Debug not launching dotnet-script correctly #771

@Bruehdiger

Description

@Bruehdiger

The default launch.json for VS Code does not work correctly for me, but I can't figure out why, everything seems to be correct.

launch.json created by dotnet script init:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Script Debug",
      "type": "coreclr",
      "request": "launch",
      "program": "${env:HOME}/.dotnet/tools/dotnet-script",
      "args": ["${file}"],
      "windows": {
        "program": "${env:USERPROFILE}/.dotnet/tools/dotnet-script.exe",
      },
      "cwd": "${workspaceFolder}",
      "stopAtEntry": false,
    }
  ]
}

The error I'm getting, when I press F5 do start debugging in VS Code:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-/home/USERNAME/.dotnet/tools/dotnet-script does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
...

dotnet --info:

.NET SDK:
 Version:           9.0.100
 Commit:            59db016f11
 Workload version:  9.0.100-manifests.3068a692
 MSBuild version:   17.12.7+5b8665660

Laufzeitumgebung:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/USERNAME/.dotnet/sdk/9.0.100/

Installierte .NET-Workloads:
Es sind keine installierten Workloads zum Anzeigen vorhanden.
Konfiguriert für die Verwendung loose manifests beim Installieren neuer Manifeste.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  8.0.404 [/home/USERNAME/.dotnet/sdk]
  9.0.100 [/home/USERNAME/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.11 [/home/USERNAME/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [/home/USERNAME/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.11 [/home/USERNAME/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [/home/USERNAME/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/USERNAME/.dotnet]

My current workaround launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Script Debug",
            "type": "coreclr",
            "request": "launch",
            "program": "${env:DOTNET_ROOT}/tools/.store/dotnet-script/1.6.0/dotnet-script/1.6.0/tools/net9.0/any/dotnet-script.dll",
            "args": [
                "${file}"
            ],
            "windows": {
                "program": "${env:USERPROFILE}/.dotnet/tools/dotnet-script.exe",
            },
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
        }
    ]
}

Am I missing something obvious? The path /home/USERNAME/dotnet/tools is also part of PATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions