Install .NET via the following script:
I advise to first do a dry run and to enable verbose mode to review if envvar DOTNET_INSTALL_DIR
is set correctly:
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version latest --verbose --dry-run
Note: Preview must include the full preview release label like 8.0.100-rc.1.23463.5
Inspect the output and validate the install path. You can override this as listed in the script its help:
export DOTNET_INSTALL_DIR=/opt/dotnet
I already had older SDK's installed in /opt/dotnet
but the script will not add new SDK's to that path automatically although the DOTNET_ROOT
envvar already points to this path.
Run the script but now without --dry-run
:
Latest
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version latest --verbose
Review the SDK's after installation:
dotnet --list-sdks
If you login or ssh
into your Raspberry PI with a different profile the dotnet
CLI may not work, and out of the box the above steps didn't allow me to install and run dotnet tool
s such as pbm
on the terminal.
An easy fix for this is to append the following to your .bashrc
profile:
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools' >> ~/.bashrc
You can easily remove SDK's by removing the corresponding folders:
sudo -s
cd DOTNET_INSTALL_DIR
rm -r sdk/$version
rm -r shared/Microsoft.NETCore.App/$version
rm -r shared/Microsoft.AspNetCore.All/$version
rm -r shared/Microsoft.AspNetCore.App/$version
rm -r host/fxr/$version
Added some instructions on how to fix the
PATH
variable via the.bashrc
file - this was a problem I ran into on my machine