Skip to content

VS Code and dotnet core: fixing ‘The terminal shell path “dotnet” is a directory’

I find myself using Linux more and more as my go-to OS, since I’m not developing anything windows specific most of the time.

Occasionally I’d switch to windows for any dotnet core development, but lately I’ve using vscode as my main editor for those tasks.

For every new project, I’d occasionally get the same annoying error, when building or launching the project from vscode:

The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink.

The dotnet executable was well part of the path. What could be the problem? And then after a painful period that felt like an eternity I got it.

I realized, that changing the “type” in the tasks.json file (.vscode folder) from process to shell solved the problem.

Vscode can now benefit from any path or other env variables present in the default shell.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "shell", //default is "process"
            "args": [ .... ]
}

Hope it helps!

See also: https://crodrigues.com/how-to-open-windows-desktop-applications-from-the-browser/

VS Code Download: https://code.visualstudio.com/

Published in.NETUncategorized

Be First to Comment

Leave a Reply