At the end of 2015 I’ve tried to install ASP.NET vNext (later renamed to core) on a Raspberry Pi, but recently .NET Core 2.0.0-beta version came out and some people already had a play with this on an ARM32 environment. Arranging myself a Raspberry Pi 3 and trying this out was next!
- The environment
- Prepare the Raspberry Pi 3
- Create a project on the Windows environment
- Running the application on the Raspberry Pi 3
- Running a MVC webpage
- Running a WebAPI project
Via https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md I found easy instructions to accomplish this.
Used versions of software/hardware:
- Raspberry Pi 3
- 16GB SanDisk microSDHC (Class 10)
- Ubuntu MATE 16.04.2 LTS
- Linux hostname 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l armv7l armv7l GNU/Linux
- .NET Core on the Raspberry Pi
- Version: 2.0.0-beta-001663-00
- Build: da54fbb7911c7ed584bfff54cdf223617959df6c
- .NET Core on my Windows machine
- Version: 2.0.0-alpha-005165
- Commit SHA-1 hash: 4a0724e136
Prepare the Raspberry Pi 3
1. Install the prereq packages via:
sudo apt-get install libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev uuid-dev
2. Get dotnet 2.0.0-beta via
Create a project on the Windows environment
The guide mentions that an .exe should be build, but although my configuration states the OutputType as Exe, I still get a .dll file. Also in the publish directory no .exe file is to be found.
Running the application on the Raspberry Pi 3
Running a MVC webpage
Next try is to get a MVC application running on the Raspberry Pi 3 using the 2.0.o-beta version of .NET. It turned out to be as easy as the console application.
The test project, with published release files, can be found on my github: https://github.com/timdows/webpages/tree/master/DemoNETCore2.0.0-betaRaspberryPi
Running a WebAPI project
I found out that some others had issues with running a WebAPI project: https://github.com/challe/dotnet-core-raspberry-pi/wiki/Setting-up-a-Web-API-on-a-Raspberry-Pi-3-(Ubuntu-16.04)-using-.NET-Core-2.x, that I found via https://github.com/stevedesmond-ca/dotnet-arm/issues/3.
Okay, lets try if this is still the case or I can just get it to work.
- There are a lot of changes since I tried beta8 on a Raspberry Pi, now it would be cool if not only Ubuntu was supported, but I guess that when .NET Core 2 is released also e.g. raspbian will be included.
- The documentation stated that an .exe file would be produced, that could be run without any other installation on a Raspberry Pi. In my case I got a dll that needed to be bootstrapped by the arm version of the 2.0.0-beta .NET Core version.
- The package references I used throughout the web apps, are not the latest. I found that 1.2.0-* is already in preview1, but as the dotnet new command did give me some older versions, and those versions worked, I just stopped there in the beginning.
- Quick testing with the 1.2.0-preview1 packages didn’t even allow me to run it on my Windows environment.
The next couple of months I’ll closely look at the status of other packages, but for now the fact that you can leave out Mono AND use an ARM32 environment looks promising more than ever!