dotnet

.NET 是開放原始碼開發平臺,只是說它是語言和程式庫的集合,可以一起建置所有類型的應用程式!

Installation

RedHat 8

.NET 6.0 已經包含在官方的 AppStream 套件庫裡。

安裝 SDK 開發環境

sudo yum install dotnet-sdk-6.0 -y

安裝 runtime 執行環境

sudo dnf install aspnetcore-runtime-6.0

檢查版本

dotnet --list-sdks
dotnet --list-runtimes

Ubuntu 22.04

Ubuntu 20.04


Linux 上的開發

Add Package from NuGet
# The internet is required
cd /path/to/your/project
dotnet add package MySql.Data

# Without the internet
# Download the package from https://www.nuget.org/
dotnet add package MySql.Data --source <path-to-package>

# Verify the package installer
dotnet list package
Publishing Applications
# Publish the framework-dependent application
dotnet publish my-app -f net6.0 -c Release

# Optional: If the application is for RHEL only, trim out the dependencies needed for other platforms
# Replace architecture based on the platform you are using
#   - For Intel: x64
#   - For IBM Z and LinuxONE: s390x
#   - For 64-bit Arm: arm64
dotnet publish my-app -f net6.0 -c Release -r rhel.8-architecture --self-contained false

NuGet

NuGet Server

Porting NuGet Package