DotnetPackaging helps you turn the publish output of a .NET application into ready-to-ship deliverables for Linux, Windows and macOS. The repository produces two related artifacts:
- NuGet libraries (
DotnetPackaging,DotnetPackaging.AppImage,DotnetPackaging.Deb,DotnetPackaging.Flatpak,DotnetPackaging.Msix,DotnetPackaging.Dmg,DotnetPackaging.Exe) that expose packaging primitives for tool authors and CI integrations. - A global
dotnettool (dotnetpackager) that wraps those libraries with a scriptable command line experience.
Supported formats today: .AppImage, .deb, .rpm, .flatpak, .msix (experimental), .dmg (experimental) and a Windows self-extracting .exe (preview).
Both flavors share the same code paths, so whatever works in the CLI is also available from your own automation. The best part? Everything is pure .NET with zero native dependencies, so you can crank out packages from whatever OS you’re using without hunting for platform-specific toolchains.
Shipping .NET apps shouldn’t require juggling half a dozen platform tools. DotnetPackaging keeps things friendly by giving you one toolbox to generate installers and bundles for the ecosystems your users actually run. No extra daemons, no native SDK rabbit holes—just run the CLI or the libraries, and your bits are ready to share. It’s a laid-back, developer-first way to make sure your app lands everywhere it needs to.
src/DotnetPackaging: core abstractions such as metadata models, ELF inspection, icon discovery and option builders.src/DotnetPackaging.AppImage: AppImage-specific logic, including AppDir builders and runtime composition.src/DotnetPackaging.Deb: helpers to produce Debian control/data archives and emit.debfiles.src/DotnetPackaging.Tool: thedotnetpackagerCLI that consumes the libraries.src/DotnetPackaging.DeployerToolandsrc/DotnetPackaging.Deployment: optional utilities for publishing packages from CI setups.
All projects target .NET 8.
Every library works with the Zafiro filesystem abstractions so you can build packages from real directories or in-memory containers. The helpers infer reasonable defaults (architecture, executable, icon files, metadata) while still letting you override everything. Use the *Packager classes as the entry point; extension methods provide FromProject and PackProject conveniences.
Key capabilities:
- Build an AppImage straight from a published directory: no temporary copies, the directory is streamed into the SquashFS runtime.
- Generate intermediate AppDir structures if you want to tweak the contents before producing the final AppImage.
- Automatically detect the main executable (ELF inspection) and common icon files, with opt-in overrides.
using DotnetPackaging.AppImage;
using Zafiro.DivineBytes;
using Zafiro.DivineBytes.System.IO;
using Zafiro.FileSystem.Core;
using Zafiro.FileSystem.Local;
var publishDir = new Directory(new FileSystem().DirectoryInfo.New("./bin/Release/net8.0/linux-x64/publish"));
var appRoot = (await publishDir.ToDirectory()).Value;
var container = new DirectoryContainer(appRoot);
var metadata = new AppImagePackagerMetadata();
metadata.PackageOptions
.WithId("com.example.myapp")
.WithName("My App")
.WithPackage("my-app")
.WithVersion("1.0.0")
.WithSummary("Cross-platform sample")
.WithComment("Longer description shown in desktop menus");
var packager = new AppImagePackager();
var appImage = await packager.Pack(container.AsRoot(), metadata);
if (appImage.IsSuccess)
{
await appImage.Value.WriteTo("./artifacts/MyApp.appimage");
}For AppDir workflows, use the CLI subcommands (appimage appdir and appimage from-appdir).
Key capabilities:
- Build
.debarchives from any container or directory that resembles the install root of your app. - Auto-detect the executable and architecture (with
FromDirectoryOptionsoverrides when you know better). - Emit
IByteSourcestreams so you can persist packages to disk, upload them elsewhere, or plug them into other pipelines.
using System.IO.Abstractions;
using DotnetPackaging.Deb;
using DotnetPackaging;
using Zafiro.DivineBytes;
using Zafiro.DivineBytes.System.IO;
var publishDir = new DirectoryContainer(new FileSystem().DirectoryInfo.New("./bin/Release/net8.0/linux-x64/publish"));
var options = new FromDirectoryOptions()
.WithName("My App")
.WithPackage("my-app")
.WithVersion("1.0.0")
.WithSummary("Cross-platform sample app");
var packager = new DebPackager();
var debResult = await packager.Pack(publishDir.AsRoot(), options);
if (debResult.IsSuccess)
{
await debResult.Value.WriteTo("./artifacts/MyApp_1.0.0_amd64.deb");
}FromDirectoryOptions exposes many more helpers (WithExecutableName, WithIcon, WithHomepage, WithCategories, WithMaintainer, etc.) so you can describe the package metadata you need.
Key capabilities:
- Generate a Flatpak layout (metadata + files/) without external tools.
- Bundle to a single
.flatpakusing the internal OSTree bundler (the CLI can optionally use systemflatpak). - Defaults-first: autodetect executable, architecture and icons; sane permissions and org.freedesktop runtime (24.08) by default.
Library (defaults-first):
using DotnetPackaging.Flatpak;
using DotnetPackaging;
using Zafiro.DivineBytes;
using Zafiro.DivineBytes.System.IO;
using Zafiro.FileSystem.Local;
var fs = new System.IO.Abstractions.FileSystem();
var container = new DirectoryContainer(fs.DirectoryInfo.New("./bin/Release/net8.0/linux-x64/publish"));
var metadata = new FlatpakPackagerMetadata();
metadata.PackageOptions
.WithId("com.example.myapp")
.WithName("My App");
var packager = new FlatpakPackager();
var bytes = await packager.Pack(container.AsRoot(), metadata);
if (bytes.IsSuccess)
{
await bytes.Value.WriteTo("./artifacts/MyApp.flatpak");
}The CLI is published as DotnetPackaging.Tool and installs a dotnetpackager command that mirrors the library APIs.
dotnet tool install --global DotnetPackaging.Tooldotnetpackager appimage– build an.AppImagefile directly from a publish directory.dotnetpackager appimage appdir– generate an AppDir folder structure for inspection/customisation.dotnetpackager appimage from-appdir– package an existing AppDir into an AppImage.dotnetpackager deb– build a Debian/Ubuntu.debout of a publish directory (anddeb from-projectto publish + package in one step).dotnetpackager rpm– build an RPM from a publish directory (rpm from-projectalso available) without owning system dirs.dotnetpackager flatpak layout– create a Flatpak layout (metadata + files/) from a publish directory.dotnetpackager flatpak bundle– create a.flatpak(uses systemflatpakby default;--systemto force system; internal fallback).dotnetpackager flatpak repo– generate an OSTree repo directory (debug/validation).dotnetpackager flatpak pack– minimal UX: only--directoryand--output-dir; auto-named output and sensible defaults.dotnetpackager msix– experimental MSIX packing from a directory (msix from-projectwhen you want it published for you).dotnetpackager dmg– experimental macOS.dmgbuilder from a publish directory (dmg from-projectto publish + package).dotnetpackager exe– preview Windows self-extracting installer builder; supportsexe from-projectand stub auto-download.
Run dotnetpackager <command> --help to see the full list of shared options (--application-name, --comment, --homepage, --keywords, --icon, --is-terminal, etc.).
Flatpak (minimal):
dotnetpackager flatpak pack \
--directory ./bin/Release/net8.0/linux-x64/publish \
--output-dir ./artifacts
# Produces ./artifacts/<appId>_<version>_<arch>.flatpakFlatpak (full control):
dotnetpackager flatpak bundle \
--directory ./bin/Release/net8.0/linux-x64/publish \
--output ./artifacts/MyApp.flatpak \
--system \
--application-name "My App" \
--summary "Cross-platform sample"Build an AppImage in one go:
dotnetpackager appimage \
--directory ./bin/Release/net8.0/linux-x64/publish \
--output ./artifacts/MyApp.appimage \
--application-name "My App" \
--summary "Cross-platform sample" \
--homepage https://example.comStage an AppDir and inspect it before packaging:
dotnetpackager appimage appdir \
--directory ./bin/Release/net8.0/linux-x64/publish \
--output-dir ./artifacts/MyApp.AppDir
# ...modify the AppDir contents if needed...
dotnetpackager appimage from-appdir \
--directory ./artifacts/MyApp.AppDir \
--output ./artifacts/MyApp.appimageProduce a Debian package with a custom name and version:
dotnetpackager deb \
--directory ./bin/Release/net8.0/linux-x64/publish \
--output ./artifacts/MyApp_1.0.0_amd64.deb \
--application-name "My App" \
--summary "Cross-platform sample" \
--comment "Longer description" \
--homepage https://example.com \
--license MIT \
--version 1.0.0All commands work on Windows, macOS or Linux, but the produced artifacts target Linux desktops.
- Use the solution
DotnetPackaging.slnand .NET SDK 8.0 or later. - Unit tests live under
test/(AppImage, Deb, Msix, etc.). DotnetPackaging.DeployerToolautomates publishing NuGet packages and GitHub releases; seeazure-pipelines.ymlfor a full CI example.
The entire project is distributed under the MIT License. See LICENSE for details.