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
- Conclusion
The environment
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:
[code]
sudo apt-get install libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev uuid-dev
[/code]
2. Get dotnet 2.0.0-beta via
[code]wget https://dotnetcli.blob.core.windows.net/dotnet/master/Binaries/Latest/dotnet-ubuntu.16.04-arm.latest.tar.gz[/code]
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.
Conclusion
- 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!
Finally 🙂 I can’t wait to try it out!
Thanks for the instruction!
Excellent! Got ‘Hello World!” working but getting various errors when trying MVC:
“libuv not found”
After changing csproj got error on dotnet restore 🙁
However Vs2017 and latest 2.0.0-beta installed properly.
>> The documentation stated that an .exe file would be produced
There should have been a exe named the same as your project in the publish folder. Was that not the case? Here are the basic instructions: https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md
If you aren’t seeing the behavior described. Please open an issue at https://github.com/dotnet/core and mention me @Petermarcu and I’ll try to take a look.
Thanks!
Next time when I create a webpage I will make sure to monitor the output closely and if needed open an issue at github
Does it work on Raspberry Pi 3 with Windows IoT Core as well?
The above tar.gz file is not available (404), I assume because 2.0 is out? Can you please update, or is there another method to follow?
I ran into the same problem David. The new URL is https://dotnetcli.blob.core.windows.net/dotnet/Runtime/master/dotnet-runtime-latest-linux-arm.tar.gz
This page lists all of them https://github.com/dotnet/core-setup/