概要
Raspberry PIに.Net開発環境を構築します。
開発環境を構築するためには以下の2つをインストールが必要です。
下記の手順通りにやってみましょう。
■開発環境
①.Netフレームワーク
②Visual Code
※MySQLは事前にインストール前提にします。
→参照サイト:https://ameblo.jp/raspberrypi-blueberry/entry-12578724754.html
.NETフレームワークをインストール
次のコマンドを実行して .NET をインストールします。
pi@raspberry:~ $ curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
dotnet-install: Downloading primary link https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.407/dotnet-sdk-3.1.407-linux-arm.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.407/dotnet-sdk-3.1.407-linux-arm.tar.gz
dotnet-install: Adding to current process PATH: `/root/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
pi@raspberry:~ $
環境変数の設定
次のコマンドを実行して .NET をインストールします。
pi@raspberry:~ $ echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
pi@raspberry:~ $ echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.bashrc
pi@raspberry:~ $ source ~/.bashrc
pi@raspberry:~ $
フレームワークのバージョン確認
次のコマンドを実行してインストールされているフレームワークのバージョンを確認します。
pi@raspberry:~ $ dotnet --version
3.1.407
pi@raspberry:~ $
開発ツールはVisual Codeを使用
次のコマンドを実行してインストールします。
pi@raspberrypi:~ $ wget https://update.code.visualstudio.com/latest/linux-deb-armhf/insider
--2021-03-30 16:23:03-- https://update.code.visualstudio.com/latest/linux-deb-armhf/insider
Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 20.43.132.130
Connecting to update.code.visualstudio.com (update.code.visualstudio.com)|20.43.132.130|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://az764295.vo.msecnd.net/insider/c71be15869a673c5ed7bfd3fe171757d2ba48142/code-insiders_1.55.0-1617069307_armhf.deb [following]
--2021-03-30 16:23:04-- https://az764295.vo.msecnd.net/insider/c71be15869a673c5ed7bfd3fe171757d2ba48142/code-insiders_1.55.0-1617069307_armhf.deb
Resolving az764295.vo.msecnd.net (az764295.vo.msecnd.net)... 117.18.232.200
Connecting to az764295.vo.msecnd.net (az764295.vo.msecnd.net)|117.18.232.200|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 65200782 (62M) [application/octet-stream]
Saving to: ‘insider’
insider 100%[=============================================>] 62.18M 514KB/s in 86s
2021-03-30 16:24:32 (737 KB/s) - ‘insider’ saved [65200782/65200782]
pi@raspberrypi:~ $ mv insider insider.deb
pi@raspberrypi:~ $ sudo dpkg -i insider.deb
Selecting previously unselected package code-insiders.
(Reading database ... 160171 files and directories currently installed.)
Preparing to unpack insider.deb ...
Unpacking code-insiders (1.55.0-1617069307) ...
Setting up code-insiders (1.55.0-1617069307) ...
grep: /etc/apt/sources.list.d/vscode.list: No such file or directory
grep: /etc/apt/sources.list.d/vscode.list: No such file or directory
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for desktop-file-utils (0.23-4) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for shared-mime-info (1.10-1) ...
pi@raspberrypi:~ $
正常にインストールされている場合、下記のように表示されます。
※参照サイト
https://github.com/microsoft/vscode/pull/106289#issuecomment-691076575
Visual Studio Code - Insidersツールを実行
次の画面のように実行されている場合は、インストールは問題ないです。
終わりに
無事にRaspberry PIに.Net環境が準備ができました。次回はC#言語を利用して何かを作ってみましょう。
本日はここまでです。最後まで読んで頂いてありがとうございます。