.NET Core And Noobs: Deploy a .NET Core IoT Application on Noobs OS


This article demonstrates how to deploy a .NET core LED on and off the application on NOOBS OS using Raspberry pi. We will port a windows application to raspbian os with Visual Studio 2019.
About .Net Core 
  • NET Core is an open-source, general-purpose development platform maintained by Microsoft
  • It's cross-platform (supporting Windows, macOS, and Linux)
  • It supports the UWP and ASP.NET
  • UWP - it is used to build a windows 10 and mobile application.
  • ASP.NET - -It is used to build a web browser-based application.
Step 1
The first step will be to create a simple .NET Core console application for Windows. Start Visual Studio 2019 and select the console app. The project name is hellodotnetiot.
Then, you need to add the GPIO NuGet Package, so select the hellodotnetiot to right-click to more options available.  Select NuGet Package and install the GPIO system configuration package.
Now, NuGet package managers are available here. Search the System.Device.Gpio then install the desired package.
Once again, check the package installation preview page. 
Step 2 
Next, go to the Project Name >> program.cs. Here is the code from program.cs, then replace the following code. 
  1. using System;  
  2. using System.Device.Gpio;  
  3. using System.Threading;  
  5. namespace hellodotnetiot  
  6. {  
  7.     class Program  
  8.     {  
  9.         static void Main(string[] args)  
  10.         {  
  11.             Console.WriteLine("Hello World, this is a dot net core iot app");  
  13.             int pin = 4;  
  14.             GpioController controller = new GpioController();  
  15.             controller.OpenPin(pin, PinMode.Output);  
  17.             while (true)  
  18.             {  
  19.                 controller.Write(pin, PinValue.High);  
  20.                 Thread.Sleep(1000);  
  21.                 controller.Write(pin, PinValue.Low);  
  22.                 Thread.Sleep(1000);  
  24.             }  
  26.         }  
  27.     }  
  28. }  
Next, right-click on the project name to see more options available, then click the publish button. It opens the publish window.
Two types of publications are available :
  • Azure Web Jobs.
  • Folder 

Now, select the folder because the windows based application package must convert the Linux-based application package.
While creating a folder profile you must set the deployment models and target runtime. Click the save button, and finally, publish the code 
Step 3 
Install the following code on the raspbian terminal.
  1. sud apt-get install curl libunwind8 gettext apt-transport-https  
Now, Installing the WinSCP tool. This tool used to sharing publish packages from Windows to Linux and modify permission limits.
Step 4
Then, go to the given directory file and run the project. Every second the LED will on and off.
  1. cd /home/pi/hellodotnetiot  
  2. ./hellodotnetion  


In this article, you learned how to deploy Windows applications on NOOBS os using Raspberry pi.
If you have any questions/ feedback/ issues, please write them below in the comment box.