Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

.net Core environment configuration and deployment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "configuration and deployment of .NET Core environment". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Environment configuration

First run the following command on the Terminal of Raspbian to install the package on which the program is running.

Sudo apt-get update sudo apt-get install curl libunwind8 gettext apt-transport-https

Prompt

① remote access Raspbian can be accessed through SSH using putty, or you can use apt to install xrdp and access through Windows remote Desktop.

② also needs to install the runtime (Runtime) to run the ASP.NET Core program. You can refer to this for installation. (whether it is 3B or 3B+, the kernel of Raspbian is 32-bit, and some NuGet packages commonly used in ASP.NET Core do not support arm32)

Open the Raspberry Pi configuration in the menu to gain access to the necessary hardware interfaces.

Open the settings for Visual Studio, and under the NuGet package manager settings, add the package source for .NET Core Lab: https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json

Blink

Friends who are familiar with Arduino know that Blink is the initial program written into Arduino by default to control the flicker of LED connected to pin 13 on the board. It's a kind of existence similar to "Hello World". Here we connect the LED lamp to the GPIO 17 pin of the Raspberry Pi.

Hardware

A small LED lamp

A 220 Ω resistor

Some DuPont lines

Electric circuit

Image source: https://github.com/dotnet/iot/tree/master/samples/led-blink

Code

Open Visual Studio and create a new .NET Core console application with the project name "Blink".

Open tools-- NuGet package Manager-- package Manager console, and run the following command to get the package.

Install-Package System.Devices.Gpio-Version 0.1.0-preview2-181222-2

In Program.cs, replace the following code:

Deployment

Run the publish command in the package Manager console:

Dotnet publish-c release-r linux-arm

Prompt

The default publishing path is "\ Blink\ bin\ Release\ netcoreappXXX\ win10-arm\ publish". You can also use-o to specify the release path, such as:-o D:\ BlinkPublish, which will be published in the BlinkPublish folder on disk D.

Use the FTP tool to copy the generated release folder to Raspberry Pi, where WinSCP is used.

Prompt

Raspbian uses the FTP service, please use apt to install vsftpd.

Change program permissions. Use the cd command to switch to the published folder and run:

Chmod 755. / Blink

Or use the FTP tool to make changes

Execute. / Blink to run the program, and the LED lights should flash.

That's all for ".NET Core Environment configuration and deployment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report