VS2019 + ASPNETCore + Raspberry Pi perfect combo

This weekend, I decided on trying to get an ASPNET Core app running on my Raspberry PI with Win 10 IOT Core. With a little YouTubing, it turns out that it is way easier than expected.

Here are the steps that worked for me:

  1. Install Win 10 IOT Core on the RPi.

  2. Powershell into the RPi and run the following commands:

    • New-NetFirewallRule -DisplayName “Allow Aspnet core traffic” -Direction Inbound -Action Allow -Protocol TCP -LocalPort 80,5000-5010
  3. Using VS2019, I created an ASPNET Core Angular app. Yes, you read it right, ASPNET Core + Angular. For now the vanilla site created works just fine.

  4. With VS2019 you can create a publish profile that is self-contained and targets Win-ARM for IoT Core or Linux-ARM if running on a Linux distro. Or, from a CLI prompt you can run the following command, which will put the needed output files in the c:\output directory:

    • dotnet publish -r win-arm --self-contained -o “c:\output”
  5. Copy the contents from this directory into your desired folder on the RPi. The folder contains several dlls and the dotnet core runtime needed for the application to run.

  6. So how did I run this application? I powershell ino the RPi. Navigate to the folder I copied the files into, then run the following command:

    • .\IotCoreSample.exe --Urls http://*:80
      note - IotCoreSample.exe is the name of my ASPNET Core application.
  7. Now you can browse your site from another computer.

  8. Couple extras.

    • Modified the Startup.cs and disable https redirect.

Looks Promising:

  • SignalR works
  • System.Device.Gpio nuget package
1 Like

You can run asp.net core on the Raspbian Linux too. I’m using for a project and it’s working really fine.


Beautiful. Maybe it is time for me to get back into maker mode once again.

1 Like

It compiles as an exe for linux as well?

I guess I’ll try this on the Pocket Beagles.

1 Like

You don’t need even to recompile. Unless you are using something special, like specific i2c or spi chips libs for Win Iot, obvously.
Just install runtime for ARM32 on RPI (you have to use same version 2.x, or 3.x), then copy program …
To run it you use:
pi@myrpi $ dotnet <name_of_the_program_dll>.dll

There’s a project on github for RPI (Microsoft Dotnet group maintained):

and here few chips drivers for RPI linux:

FYI: Take a look at Blazor project, https://blazor.net. It can be hosted on Asp.net core Kestrel web server on PI and code run in the client browser, using behind SignalIR for client/server comms.

Please show me how! I do not think the core included peripherals yet.

from Nuget (myget.org) package :slight_smile:


The System.Device.Gpio preview package supports general-purpose I/O (GPIO) pins, PWM, I2C, SPI and related interfaces for interacting with low level hardware pins to control hardware sensors, displays and input devices on single-board-computers; Raspberry Pi, BeagleBoard, HummingBoard, ODROID, and other single-board-computers that are supported by Linux and Windows 10 IoT Core OS can be used with .NET Core and System.Device.Gpio. On Windows 10 IoT Core OS, the library wraps the Windows.Devices.Gpio.dll assembly. On Linux, the library supports three driver modes: libgpiod for fast full-featured GPIO access on all Linux distros since version 4.8 of the Linux kernel; slower and limited-functionality GPIO access via the deprecated Sysfs interface (/sys/class/gpio) when running on older Linux distro versions with a Linux kernel older than version 4.8; and lastly board-specific Linux drivers that access GPIO addresses in /dev/mem for fasted performance at the trade-off of being able to run on very specific versions of single-board-computers. In the future, the board-specific Linux drivers may be removed in favor of only supporting libgpiod and sysfs Linux interfaces. In addition to System.Device.Gpio, the optional IoT.Device.Bindings NuGet package contains device bindings for many sensors, displays, and input devices that can be used with System.Device.Gpio.


Also, if you preferred not to installed the runtime, another thing to consider is doing a self-contained deployment, where runtime time goes with the application. The disadvantage is deployment is larger, but the benefits of doing this are you don’t have to worry about installing the dotnet core runtime on the target machine, and you can also have multiple versions of your app using a different runtimes. This is true for whether you are using on Linux or Win10.


Fully Agree !

I ve done several things around Raspbian, .netcore and Sqlite that seem promizing !

1 Like


Yes SingalR + Core works well on the Pi. Have been using it for >12 months for sending back telemetry to several connected field laptops.
The multi broadcast ability works well for telemetry as you dont need to worry about handling connections / lost connections.

Also I think System.Device.Gpio got brought into the Base Class Lib fro Core 2.2 or 2.1 ??
At some point it got brought in and dont need to reference the NuGet package anymore.

You don’t have to reference it? Are you sure? Can you check again, I don’t see it in my Core 2.2.0

Appologies John, I think I was thinking of SignalR.

All sound interesting. Where is my step by step to blink an LED on pocket beagle? :wink:

1 Like

Actually it’s frightfully simple to blink the usr leds:


The command that I run “echo heartbeat > trigger” causes the usr3 led to pulse like the usr0 led.

Who wants to do that?! I mean do it in C#, in .NET, from visual studio.

1 Like

@Gus, I don’t own a Beagle board, but I think you can start the same way for raspberry.
Try creating a new Console .NET Core project. Then add nuget reference to package System.Device.Gpio (0.1.0 prerelease, so enable prerelease), and to Iot.Device.Binding (same release).
Create your code … blink blink…
When you need to deploy, create a “publish” entry.

NOTE: You can choose “SELF Contained” instead of “Framework Dependent” to avoid dotnet core install on beagle board.

Transfer the published files to beagle board. (I use https://mobaxterm.mobatek.net/ , an absolute must-have for linux access from Win that beside ssh, it start also sftp bar).
run (ehmmm hope to run) program with direct "./<your_prograname> or "dotnet <your_prograname>.dll
Note2: To start shell ./<your_prograname>, it needs a chmod +x.

That’s all folks to test…

1 Like

I think he means more detailed that that. No prob. I’ll see what I can do.

1 Like

Ya… really I can’t imagine @Gus_Issa that needs a tutorial to start a project on VS … ahahah :smile: