0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu 20.04 に .NET 6.0 SDK をインストール

Last updated at Posted at 2022-08-16

.NET 6.0 は 古いOSだと windows 7 sp1 から対応していてmacでもLinuxでも動いて良いかも、と思いました。

インストール

curl -O -L -s "https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb"

sudo apt update && sudo apt install -y apt-transport-https

sudo apt install -y dotnet-sdk-6.0

dotnet --version

プロジェクトの作成

mkdir console && cd console

# dotnet new プロジェクト名
dotnet new console

サンプル

dotnet run
  • hello world が表示されることを確認。9秒くらいかかる。

build

dotnet build
  • 8秒くらいかかった。
# ビルドされたものを実行
bin/Debug/net6.0/console
  • 瞬時に実行された。

ランタイム同梱

64 MB 程になる。

dotnet build --sc -r linux-x64
dotnet build --sc -r win-x86
dotnet build --sc -r win-x64
dotnet build --sc -r osx-x64

dotnet build --sc -r win

-r は以下指定

ランタイム同梱しない場合

  • 150 kb 程度で済む。
dotnet build -r win-x86 --sc=false
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?