Setting Up .NET Core on a Raspberry Pi

Posted on September 15, 2021 · 1 min read

This is a quick excercise to get .NET Core SDK up and running on a Raspberry Pi.

No .NET SDK installed demo No .NET SDK installed demo

As we can see, executing the dotnet command does not work.

At the time of writing, I have downloaded the ARM32 .NET SDK version 5.0.401, however we may be able to download a later/different version by visiting the .NET Download page. We can get more details about the installed Raspberry Pi OS so that we can install the correct SDK by using the cat /etc/os-release and uname -m command.

Download and install the .NET SDK onto the raspberry pi by issuing the following commands:

   sudo apt-get install curl libunwind8 gettext
   mkdir -p $HOME/dotnet
   tar zxf dotnet-sdk-5.0.401-linux-arm.tar.gz -C $HOME/dotnet
   export DOTNET_ROOT=$HOME/dotnet
   export PATH=$PATH:$HOME/dotnet

Note that the two “export” command only applies to the current shell session. To make them permanent, we will need to add them to “.bashrc”.

Installing .NET SDK demo Installing .NET SDK demo

Now let’s quickly create a Hello World console app just to make sure the tooling and environment are correctly setup.

Creating a new .NET Core console app Creating a new .NET Core console app

and that’s it, we are done. The .NET 5 SDK (and therefore also the .NET 5 runtime) are installed. So whether we want to develop on target or cross compiled, the options are there.