Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run .NET Core on Raspberry PI?

I've heard that .NET Core could run on Linux and Mac as well. I am currently using Mono on Raspberry PI. Is it possible or will it be possible to run .NET Core on Raspberry PI?

like image 469
TN. Avatar asked Nov 13 '14 11:11

TN.


People also ask

Can I host .NET Core on Linux?

Net Core framework the key selling point was it is a cross-platform framework, which mean't that now we can host our . Net application not only on Windows but on Linux too, so let's see how we can deploy .

What platforms can .NET Core run on?

NET Core is cross-platform. It runs on Windows, OS X and multiple distributions of Linux. It also supports different CPU architectures.

Is .NET Core good for Linux?

NET Core allows using it also on Mac or Linux on Visual Studio Code. This software also includes IntelliSense and debugging. Building microservices with . NET Core enables you to use different technologies, frameworks, or languages at microservice level.


2 Answers

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

like image 113
TN. Avatar answered Sep 21 '22 06:09

TN.


Now you can run dotnet core on Raspberry PI. In order to do that you need to:

  1. Cross-compile coreclr & corefx (possible on Linux x64 machine)
  2. Extract the dlls without the private and precompiled files to the PI
  3. Copy your app's managed dlls to the PI
  4. 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

like image 34
Adi Avatar answered Sep 18 '22 06:09

Adi