Skip to main content

Linux 上的開發

Create new project
dotnet new console --output my-app
dotnet run --project my-app
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