LoginSignup
3
5

More than 1 year has passed since last update.

Raspberry Pi で .Net を使う

Last updated at Posted at 2019-12-26

Download .NET 6.0 から SDK をダウンロードします。

dotnet-sdk-6.0.302-linux-arm.tar.gz

解凍します。

mkdir dotnet
cp dotnet-sdk-6.0.302-linux-arm.tar.gz dotnet
cd dotnet
tar xvfz dotnet-sdk-6.0.302-linux-arm.tar.gz

PATH の設定を .bashrc に加えます。

.bashrc
#
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet

ログインし直してバージョンの確認

$ dotnet --version
6.0.302

プロジェクトの作成

mkdir Test01
cd Test01
dotnet new console

次のようなファイルが出来ます。

$ ls
Program.cs  Test01.csproj  obj

Program.cs を次のように改造します。

Program.cs
Console.WriteLine("Hello, World!");
Console.WriteLine("This is a Test!");

コンパイルと実行

$ dotnet run
Hello World!
This is a Test!

再実行

$ bin/Debug/net6.0/Test01
Hello World!
This is a Test!

次の環境で確認しました。

$ uname -a
Linux violet 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l GNU/Linux
3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5