Is it possible to run .NET Core on Raspberry PI?
I have managed to run .NET Core 2 app on Raspberry PI 3 with Raspbian.
I have followed https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md and https://github.com/dotnet/core/issues/447:
On my laptop:
Install .NET Core 2.0 SDK
Run
mkdir helloworld
cd helloworld
dotnet new console
Edit helloworld.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win-arm;linux-arm</RuntimeIdentifiers>
</PropertyGroup>
</Project>
Run
dotnet publish -r linux-arm
On Raspberry PI 3 with Raspbian:
Run sudo apt-get install libc6 libcurl3 libgcc1 libgssapi-krb5-2 libicu52 liblttng-ust0 libssl1.0.0 libstdc++6 libunwind8 libuuid1 zlib1g
Then copy ./bin/Debug/netcoreapp2.0/linux-arm/publish
from my laptop
[Modified permissions of helloworld
]
Run ./helloworld
Now you can run dotnet core on Raspberry PI. In order to do that you need to:
- Cross-compile coreclr & corefx (possible on Linux x64 machine)
- Extract the dlls without the private and precompiled files to the PI
- Copy your app's managed dlls to the PI
- Use "corerun" executable to run your app
If you want to skip the above and get a ready made binaries for the Raspberry PI 3 (or even the entire image), you can use my compiled build at:
http://ravendb.net/promo/xmas-win-raspberry-pi
Note: I was able to do that on Raspberry PI 3, using Headless Ubuntu Server 16.04 and with Ubuntu Mate 16.04. I presume additional steps (i.e. installing additional packages) needed to be done on Raspbian OS and PI 2.
Links for Cross Compilation (on Ubuntu 16.04 x64 machine):
- coreclr : https://github.com/dotnet/coreclr/blob/master/Documentation/building/cross-building.md
- corefx : https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-building.md
A video I made with "how to" get the binaries (which includes our app):
https://www.youtube.com/watch?v=DPxCVDOUlT8
Now or soon it will be possible because Microsoft announced CoreCLR is available on GitHub.
Today, .NET Core builds and runs on Windows. We will be adding Linux and Mac implementations of platform-specific components over the next few months. We already have some Linux-specific code in .NET Core, but we’re really just getting started on our ports. We wanted to open up the code first, so that we could all enjoy the cross-platform journey from the outset.