Overview

I just started playing around with .Net Core since it has hit the 2.0 release.  Since I have used Raspberry Pi’s on many projects I thought it was time to do a hello world Asp.Net Core project that is served up on a Raspberry Pi using Raspbian for the OS.  Here is how I got that going.

My goal was to create the default out of the box ASP.Net Core MVC application on my Windows 10 developer machine and publish it targeting ARM and see if I could get that running on the Raspberry Pi.  I do not intend to compile applications on the Raspberry Pi as I believe that would just be slow going.  I have longer term goals like being able to debug on the Pi from my Dev machine but lets take baby steps first.

Setting up the Raspberry Pi

At the time of writing this post it wasn’t real clear to me how to get .Net Core running on my Raspberry Pi with the latest Raspbian OS.  On the Dotnet Core Docs site, there were instructions that targeted specific Linux distros but nothing that I saw specifically for Raspbian.  However I did find another blog post by Jeremy Lindsay that got me to the point that .Net Core 2 was installed on my Raspberry Pi.  I am not going to go into deep details on how to get Raspbian installed and how you shell into a terminal on a linux box as that is covered on many other posts (including Jeremy’s).

Run the following commands in a terminal window on the Raspberry Pi:

 
# Update the Raspbian Jessie install 
sudo apt-get -y update 

# Install the packages necessary for .NET Core 
sudo apt-get -y install libunwind8 gettext 

# Download the nightly binaries for .NET Core 2 
wget https://dotnetcli.blob.core.windows.net/dotnet/Runtime/release/2.0.0/dotnet-runtime-latest-linux-arm.tar.gz

# Create a folder to hold the .NET Core 2 installation 
sudo mkdir /opt/dotnet 

# Unzip the dotnet zip into the dotnet installation folder 
sudo tar -xvf dotnet-runtime-latest-linux-arm.tar.gz -C /opt/dotnet 

# set up a symbolic link to a directory on the path so we can call dotnet 
sudo ln -s /opt/dotnet/dotnet /usr/local/bin 
 

At this point you should be able to test the install by executing the following in a terminal window on the Raspberry Pi:


dotnet --info

And you should get something back that tells you what version on dotnet core you have.

dotnetcore

Conclusion

As you can see getting the .Net Core 2 on your Raspberry Pi is pretty easy.  Next post I will go into creating an MVC hello world app and running it on the Raspberry Pi.

Comments


Comments are closed