The terminal shell path "dotnet" is a directory - Visual Studio Code

I have been using Visual Studio Code in Ubuntu Linux for a while, but it was not an easy process to get it working the first time.

I just got around to installing .NET Core 3.1 and hit a familiar problem -

The terminal shell path "dotnet" is a directory

This happens when I try to build inside VS Code using a build task, I point this out because building from a terminal inside VS Code works fine.

Here is the output -

1> Executing task: dotnet build /home/bryan/dev/blog/SomeProject/SomeProject.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary <
2
3The terminal shell path "dotnet" is a directory
4
5Terminal will be reused by tasks, press any key to close it.

If you google this you will find some suggested fixes but they didn’t work for me.

Here is what does work for me -

  1. Install the SDKs to a directory NOT named dotnet, my SDK’s are in $HOME/msdotnet
  2. Update your PATH to include this directory - PATH=$PATH:$HOME/msdotnet
  3. Update your DOTNET_ROOT to this – DOTNET_ROOT=$HOME/msdotnet

That’s what works for me.

Whenever I need to install a new SDK I have do follow the manual steps outlined
here, making sure to unpack the SDK to $HOME/msdotnet.

Hope this works for you, please leave a comment if it does or even if it doesn’t.

comments powered by Disqus

Related