Search code examples
.netasp.net-core.net-coreraspberry-piraspbian

Dotnet command not recognized after reboot Raspbian


I want to run my asp.net core application on Rasbpian buster OS on raspberry pi 3 B after reboot, but dotnet commad not recognized after reboot, and I face with this error [dotnet: command not found].

After I run these two lines of code on terminal the dotnet command can run correctly.

export DOTNET_ROOT=$HOME/dotnet 
export PATH=$PATH:$HOME/dotnet

You can see screenshot of my SSH connection through Putty to raspberry pi after reboot.

enter image description here


Solution

  • The PATH is a :-seperated list of every directory where files should be executable by just writing the name of the file in the command line. (You still need the x permission)

    dotnet is not in your PATH.

    The command export PATH=... changes the PATH for your current session.

    If you want to have dotnet everytime on startup, create a symlink from /usr/bin/dotnet to $HOME/dotnet/dotnet:

    sudo ln -s "$HOME/dotnet/dotnet" "/usr/bin/dotnet"
    

    or add copy the command to the bottom of the $HOME/.bashrc file.

    [NOTE]

    If you don't have dotnet installed on $HOME/dotnet/, you will need to change that directory in the ln command