2017-01-19 18:06:56 +01:00
# .NET Core on Raspberry Pi
2017-07-14 17:20:16 +02:00
Arm32 build are available as community supported builds for .NET Core 2.0.
There is no SDK that runs on ARM32 but you can publish an application that will run on a Raspberry Pi.
2017-02-25 01:32:15 +01:00
2017-03-12 05:41:02 +01:00
These steps have been tested on a RPi 2 and RPi 3 with Linux and Windows.
2017-01-19 18:06:56 +01:00
2017-07-14 17:20:16 +02:00
Note: Pi Zero is not supported because the .NET Core JIT depends on armv7 instructions not available on Pi Zero.
2017-03-20 21:52:07 +01:00
## Creating an app:
2017-01-19 18:06:56 +01:00
2017-05-16 00:04:49 +02:00
* [Install .NET Core 2.0 SDK ](https://www.microsoft.com/net/core/preview ) into a supported developer configuration.
2017-01-19 18:06:56 +01:00
2017-04-02 21:56:36 +02:00
2017-03-28 12:27:42 +02:00
* From the terminal/commandline create a folder named `helloworld` and go into it.
* Run `dotnet new console`
2017-07-14 17:20:16 +02:00
* You can find a `helloworld.csproj` file is created under current directory.
2017-02-25 01:32:15 +01:00
```
< Project Sdk = "Microsoft.NET.Sdk" >
2017-01-19 18:06:56 +01:00
2017-02-25 01:32:15 +01:00
< PropertyGroup >
< OutputType > Exe< / OutputType >
< TargetFramework > netcoreapp2.0< / TargetFramework >
< / PropertyGroup >
2017-01-19 18:06:56 +01:00
2017-02-25 01:32:15 +01:00
< / Project >
```
2017-01-19 18:06:56 +01:00
2017-05-16 00:04:49 +02:00
* If you get restore errors, make sure you have a nuget.config file next to your csproj that includes the dotnet-core myget feed: `<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />` .
2017-04-02 21:56:36 +02:00
2017-04-03 18:10:50 +02:00
```
<?xml version="1.0" encoding="utf-8"?>
< configuration >
< packageSources >
< add key = "dotnet-core" value = "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" / >
< / packageSources >
< / configuration >
```
2017-05-16 00:04:49 +02:00
* Run `dotnet publish -r <runtime identifier>` for example `dotnet publish -r win-arm` to publish the application for windows and `dotnet publish -r linux-arm` for Linux running on Raspberry Pi.
2017-01-19 18:06:56 +01:00
2017-02-25 01:46:51 +01:00
* Under `./bin/Debug/netcoreapp2.0/<runtime identifier>/publish` or `.\bin\Debug\netcoreapp2.0\<runtime identifier>\publish` you will see the whole self contained app that you need to copy to your Raspberry Pi.
2017-01-19 18:06:56 +01:00
2017-03-20 21:52:07 +01:00
## Getting the app to run on the Pi.
2017-01-19 18:06:56 +01:00
2017-05-22 16:32:23 +02:00
### Linux
2017-01-19 18:06:56 +01:00
2017-05-16 00:04:49 +02:00
* Install [Linux ](https://www.raspberrypi.org/downloads/ ) on your Pi.
2017-01-19 18:06:56 +01:00
2017-07-18 01:22:24 +02:00
* Install the [prereq packages ](https://github.com/dotnet/core/blob/master/Documentation/prereqs.md ) for .NET Core.
2017-01-19 18:06:56 +01:00
2017-07-18 01:22:24 +02:00
* Copy your app to the Raspberry Pi and execute run `./helloworld` to see `Hello World!` from .NET Core running on your Pi! (make sure you `chmod 755 ./helloworld` )
2017-01-19 18:06:56 +01:00
2017-03-20 21:52:07 +01:00
### Win10 IoT Core
2017-01-19 18:06:56 +01:00
* Install [Windows 10 IoT Core ](https://developer.microsoft.com/en-us/windows/iot/GetStarted ) on your Pi.
2017-02-25 01:34:43 +01:00
* Copy your app to the Raspberry Pi and execute run `helloworld.exe` to see `Hello World!` from .NET Core running on your Pi