superkind
7/2/2018 - 1:46 PM

맥에서 라즈베리파이용 .Net Core 앱 만들기

#csharp #dotnet #raspberrypi

.Net Core on Raspberry Pi

macOS에서 .NET Core 빌드

Visual Studio 2017 Community에서 .Net Core 프로젝트를 생성한후 빌드한다.

namespace dotnet_pi_mk0
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}
  • 프로젝트 폴더에서 다음 명령을 실행하여 ARM버전용으로 빌드한다. dotnet publish -r linux-arm
  • ./bin/Debug/netcoreapp2.0/linux-arm/publish 폴더 전체를 라즈베리파이로 복사한다.

라즈베리파이에서 실행

  • 다음 명령어를 실행한다.
sudo apt-get update
sudo apt-get install curl libunwind8 gettext apt-transport-https
  • 복사된 publish폴더에서 sudo ./helloworld 명령으로 실행한다.