Build, Packaging, CI/CD and Deployment
dotnet pack -c Release → dotnet nuget push *.nupkg -s <feed> -k <key> (nuget.org, GitHub Packages, Azure Artifacts).
48.1 Build Configuration
Debug/Release configurations, platform targets (AnyCPU, x64, ARM64), Directory.Build.props, .editorconfig, deterministic builds, Source Link, versioning (<Version> or MinVer/GitVersion from Git tags).
48.2 Publishing Options
dotnet publish -c Release -r win-x64 --self-contained false # needs the .NET runtime installed
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true
dotnet publish -c Release -r linux-x64 --self-contained # console/worker on Linux48.3 Desktop Distribution
Simple install and auto-update (WinForms/WPF), supported on .NET 6+
Modern packaging, Microsoft Store or sideloading, clean uninstall
WiX Toolset / Inno Setup / Advanced Installer Traditional MSI/EXE installers Velopack / Squirrel Publish a manifest for winget install
48.4 Libraries and NuGet
dotnet pack -c Release → dotnet nuget push *.nupkg -s <feed> -k <key> (nuget.org, GitHub Packages, Azure Artifacts).
<PropertyGroup>
<PackageId>Shop.Core</PackageId>
<Version>2.1.0</Version>
<Authors>Your Team</Authors>
<Description>Core domain library for Shop</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>48.5 CI/CD Example (GitHub Actions)
Containers: VB console/worker/API apps run in Linux containers (mcr.microsoft.com/dotnet/runtime:8.0, aspnet:8.0). WinForms/WPF don't.
name: build
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with: { dotnet-version: '8.0.x' }
- run: dotnet restore
- run: dotnet build -c Release --no-restore
- run: dotnet test -c Release --no-build --collect:"XPlat Code Coverage"
- run: dotnet publish src/Shop.Desktop -c Release -r win-x64 --self-contained -o out
- uses: actions/upload-artifact@v4
with: { name: shop-desktop, path: out }