What is .Net Core?
.Net Core is a framework from Microsoft that runs on all of the common desktop platforms. They took all of the awesome stuff from .Net Framework and left out the bloaty and unnessecary parts. From .Net Core 3 you also get a integrated UI.
Why would I run this on my raspberry?
Because it's a leightweight and easy way of running .Net stuff on a cheap system.
Why not using other stacks?
.Net and it's native IDE, Visual Studio, evolved a lot in the past. Its really easy to get external packages up and running in your project. Especially when building API projects, there is awesome scaffolding, getting you up and running with zero effort by yourself.
"Install" the newest .Net Core for your raspi from .net core download site, which for mine was ARM32, unzip it and create a shortcut to run it.
wget %downloadlink% -O dotnet.tar.gz
Unzip and create shortcut
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet sudo ln -s /opt/dotnet/dotnet /usr/local/bin
You should see some output from installed versions and libraries. In case you get an error for a wrong executable, you downloaded the wrong package, check your OS and architecture and download the right one)
Ready to go!
Install git in case you don't have it installed yet
sudo apt update && sudo apt install git
I created a fresh API project and made it configurable, checked it into github and downloaded it via git clone. In case you don't want to setup a project by yourself, you can use my sample project from github
git clone https://github.com/llotz/CoreAPI.git
which will clone the repo to a folder called CoreAPI (or whatever the project of your choice is).
Now navigate inside the folder and build the project
cd CoreAPI dotnet build
This took ~20 sec on my raspi 3. Once built you can run the project.
dotnet run CoreAPI/bin/Debug/netcoreapp3.0/CoreAPI.dll
the application should start up and you are able to access it from localhost. In case you want to expose the API to your network, run
dotnet run CoreAPI/bin/Debug/netcoreapp3.0/CoreAPI.dll urls="http://localRaspiIP:5000;https://localRaspiIP:5001"
.. replace localRaspiIP with the IP and you can access it from within your network like
You're now able to build and run dotnet core projects on your raspi. This can be helpful to build a production pipeline watching your git repo or getting around setting up docker on your raspi (as your docker images have to be supporting ARM architecture)