---
title: "Packaging: files to hand out"
url: https://recursiveai.org/oneapp/docs/packaging/
description: "oneapp install puts an app in the current user's launcher from source. To give an app to other people there is a file to download:"
version: "1.0.0"
source: https://github.com/recursive-ai-oss/oneapp-csharp/blob/64b0f3162f8c1b7bb766ceae32357442feaa5960/docs/packaging.md
---

# Packaging: files to hand out

`oneapp install` puts an app in the current user's launcher from source. To give an app to other people there is a file to download:

| Platform | Command | Result |
|---|---|---|
| Linux | `oneapp package <project> --format deb` | `<package>_<version>_<arch>.deb` |
| Linux | `oneapp package <project> --format appimage` | `<Name>-<version>-<arch>.AppImage` |
| macOS | `oneapp install <project> --dmg` | an `.app` bundle and a `.dmg` (see [macOS](#macos-app-bundle-and-disk-image)) |

The Linux packages are not signed. macOS bundles and images are signed, and notarized when notary settings exist; Windows packages are signed when a certificate exists. Nothing is published for you; accounts, certificates and package repositories belong to whoever owns them. [Set up signing once](#set-up-signing-once) below.

## macOS: app bundle and disk image

```
oneapp install <project|dir> [--prefix ~/Applications] [--configuration Release] [--rid osx-arm64] [--no-aot]
                             [--dmg] [--dmg-out FILE] [--identity NAME] [--entitlements FILE]
oneapp uninstall <app id|project|dir> [--prefix DIR]
```

`install` publishes the app (NativeAOT when the project sets `PublishAot`; `--no-aot` publishes a self-contained managed build) and builds `<prefix>/<OneAppName>.app`: `Contents/Info.plist` (bundle identifier `OneAppId`, `OneAppName`, `OneAppVersion` default `1.0`, high-resolution capable), `Contents/Resources/AppIcon.icns` (the `OneAppIcon` PNG scaled to every icon-set size with `sips` and `iconutil`; use a 1024-pixel square source) and the published program in `Contents/MacOS`. The default prefix is `~/Applications`, never `/Applications`. The command prints one JSON object: `appId`, `bundle`, `exec`, `dmg`, `signed`.

**Sealing.** The bundle is signed ad hoc (`codesign --sign -`, no certificate), which Apple silicon requires and which ties the bundle identifier to the program, so notification permission is kept per app. `codesign` wants every file in `Contents/MacOS` signed before it seals the bundle, not only Mach-O files: a NativeAOT app has one file there, a managed `--no-aot` app has hundreds of assemblies. `install` signs those files, then the bundle, then runs `codesign --verify --deep --strict` and fails with `sign_failed` and codesign's message if the bundle does not pass. Both kinds of bundle verify and launch through LaunchServices.

**Signing with your own identity.** `--identity "Developer ID Application: Name (TEAMID)"` (or the environment variable `ONEAPP_SIGN_IDENTITY`) signs with that certificate from your keychain instead: with the hardened runtime and a secure timestamp, which notarization requires, and the disk image is signed too. A managed `--no-aot` bundle also gets the entitlements the .NET runtime needs under the hardened runtime (`allow-jit`, `allow-unsigned-executable-memory`, `disable-library-validation`); `--entitlements FILE` replaces them. With notary settings (below) the image, or the bundle when there is no image, is also submitted to Apple's notary service, waited on and stapled. An ad-hoc-signed app that was downloaded from the internet is held back by Gatekeeper until the user allows it in System Settings; a notarized one is not.

**The disk image.** `--dmg` (or `--dmg-out FILE`, default `<prefix>/<name>.dmg`) builds a compressed read-only image, volume name `<OneAppName>`, that holds the bundle and a link to `/Applications`. Opening it shows the app and the Applications link; dragging the app to either Applications folder (or `cp -R` / `ditto`) installs it, and the copy verifies and launches the same as the original. Eject the image afterwards (`hdiutil detach "/Volumes/<name>"`).

**Uninstalling.** Drag the app from `~/Applications` to the Trash, or run `oneapp uninstall <app id>` (it removes every `.app` in `--prefix` whose bundle identifier matches, and exits 1 when it removed none). The app's own data is not touched; it is where the app put it: normally `~/Library/Application Support/<OneAppId>`, `~/Library/Preferences/<OneAppId>.plist` and `~/Library/Caches/<OneAppId>`, which can be deleted by hand.

A Debug install keeps the development harness (Release builds contain no listener); a LaunchServices launch passes it with `open --env ONEAPP_HARNESS=unix:auto --env ONEAPP_HARNESS_INFO=FILE <bundle>`. See [harness.md](https://recursiveai.org/oneapp/docs/harness/).

## `oneapp package`

```
oneapp package <project|dir> --format appimage|deb [--rid linux-x64|linux-arm64] [--output DIR] [--configuration Release] [--no-aot]
```

It publishes the app (NativeAOT when the project sets `PublishAot`; `--no-aot` publishes a self-contained managed build, meant for trying things on a machine without the native toolchain), then writes the package into `--output` (default: the current folder) and prints one JSON object: `format`, `file`, `size`, `package`, `version`, `depends` (deb). Errors are one JSON object with a `code` and a `message` that names the fix; exit code 2 means the project needs a change, 1 means the tool or a download failed.

Build on the oldest distribution you want to support: a NativeAOT program is linked against the glibc it was built with, and the deb's `Depends` records that version. Cross-architecture builds (`--rid linux-arm64` on x64) need the cross toolchain `dotnet publish` itself asks for.

Symbol files (`*.dbg`, `*.pdb`) and API documentation (`*.xml` with a `<doc>` root) are left out of both formats.

### Project properties

The same MSBuild properties `oneapp install` reads, plus the ones a package needs:

| Property | Used for | Default |
|---|---|---|
| `OneAppId` | desktop entry and icon file name; reverse-DNS | required |
| `OneAppName` | the entry's `Name`; the AppImage file name | the id |
| `OneAppComment` | the entry's `Comment`; the deb's one-line description | the name |
| `OneAppCategories` | the entry's `Categories` | none |
| `OneAppIcon` | PNG or SVG, path relative to the project | none (required for an AppImage) |
| `OneAppVersion` | package version | `1.0.0` |
| `OneAppMaintainer` | deb `Maintainer`, `Name <address>` | required for a deb |
| `OneAppPackageName` | deb package name (lower case letters, digits, `+ - .`) | the assembly name, lower-cased |
| `OneAppDescription` | extra paragraphs of the deb description | none |
| `OneAppHomepage` | deb `Homepage` and the copyright file's source line | none |
| `OneAppLicense` | the copyright file's license line | "see the project" |
| `OneAppDebSection` | deb `Section` | `utils` |
| `OneAppDebDepends` | extra deb dependencies, comma separated | none |

The version must start with a digit and use only letters, digits and `. + ~ - :` (Debian Policy 5.6.12). `SOURCE_DATE_EPOCH`, when set, becomes the archive's modification time.

## The deb

Written by this tool, so `dpkg-deb` is not needed to build one. Layout:

- `/usr/lib/<package>/`: the published files.
- `/usr/bin/<package>`: a symbolic link to the program.
- `/usr/share/applications/<OneAppId>.desktop`: the desktop entry (`Exec=/usr/bin/<package> %U`).
- `/usr/share/icons/hicolor/<W>x<H>/apps/<OneAppId>.png` (or `scalable/apps/<OneAppId>.svg`).
- `/usr/share/doc/<package>/copyright`.

The archive is the `ar` container `deb(5)` describes: `debian-binary` (`2.0`), `control.tar.gz` (`control`, `md5sums`) and `data.tar.gz`, ustar tars owned by root. Check one with `dpkg-deb --info` and `--contents`.

### Dependencies

`Depends` is computed from the published files, not guessed:

1. Every `DT_NEEDED` library of every ELF file in the publish folder that the folder does not carry itself, mapped to its Debian package (`libc.so.6`, `libm.so.6` and the loader to `libc6`; `libstdc++.so.6` to `libstdc++6`; `libz.so.1` to `zlib1g`; ...). A library the table does not know is an error (`unknown_library`): name its package in `OneAppDebDepends`.
2. `libc6 (>= X.Y)`, where X.Y is the newest `GLIBC_` symbol version the files use (`DT_VERNEED`).
3. The libraries OnePlatform opens with `dlopen`, which never show up as `DT_NEEDED`: `libvulkan.so.1` (`libvulkan1`), `libwayland-client.so.0` (`libwayland-client0`), `libX11.so.6` (`libx11-6`) and `libxkbcommon.so.0` (`libxkbcommon0`). The binary uses whichever of Wayland or X11 the session offers, so both are required.
4. `OneAppDebDepends`.

`Recommends` lists what is used when present: `mesa-vulkan-drivers | libvulkan-driver` (a Vulkan driver), `libx11-xcb1` and `libxkbcommon-x11-0` (the X11 session's keyboard handling), and `xdg-desktop-portal` (file dialogs, notifications, global shortcuts, screenshots).

## The AppImage

A type 2 AppImage ([specification](https://github.com/AppImage/AppImageSpec/blob/master/draft.md)): the AppImage project's runtime, then a SquashFS 4 image of an AppDir:

- `AppRun`: a shell script that starts `usr/bin/<program>` from wherever the image is mounted.
- `<OneAppId>.desktop` with `Icon=<OneAppId>`, `Exec=<program>` and `X-AppImage-Version`.
- `<OneAppId>.png` (or `.svg`) and `.DirIcon`.
- `usr/bin/`: the published files.

The image is written by this tool (zlib-compressed SquashFS, no fragments or extended attributes), so `mksquashfs` is not needed. The runtime is a binary of the AppImage project's, not ours: `oneapp` downloads the pinned release (`runtime-x86_64` or `runtime-aarch64` of `type2-runtime` 20251108) on first use, checks its SHA-256 against the value compiled in, and keeps it under `$XDG_CACHE_HOME/oneapp/appimage-runtime/` (else `~/.cache`). Nothing of it is in this repository. Without network access, download the file yourself and set `ONEAPP_APPIMAGE_RUNTIME` to it; it is checked against the same hash.

Running one needs FUSE 2 or 3 (`fusermount`) to mount the image. Without it, `./App.AppImage --appimage-extract-and-run` unpacks to a temporary folder and runs from there; `--appimage-extract` unpacks only. Desktop integration (a launcher entry that runs the file) is the user's, or a helper's: copy the `.desktop` file out of the image, set its `Exec=` to the `.AppImage` path and put it in `~/.local/share/applications/`.

Both formats carry the development harness only if the app was published with `--configuration Debug`; Release packages contain no listener.

## Checking a package

```
dpkg-deb --info App.deb; dpkg-deb --contents App.deb
dpkg-deb -x App.deb /some/scratch/root && /some/scratch/root/usr/bin/<package> ...
./App.AppImage --appimage-extract-and-run     # or just run it
unsquashfs -l -offset $(./App.AppImage --appimage-offset) App.AppImage
```

## Windows: MSIX

`oneapp package <project> --format msix` publishes the app for `win-x64` (or `--rid win-arm64`) and writes an `.msix`, an ordinary package that Windows installs per user once it is signed; with a certificate configured (below) it is signed here. It reads the same project properties as the other formats (`OneAppId` becomes the package name, `OneAppName` the display name, `OneAppVersion` the version, padded to four parts, and `OneAppIcon` the tile logos). `--publisher "CN=Name"` sets the package publisher; it must equal the subject of the certificate you sign with. The writer is ours: a stored zip, the block map, the manifest and the content types, with no Windows SDK needed to produce the file. The result object says `"signed"` and `"timestamped"`; with no certificate it is `"signed": "false"` and a note on stderr says what to set.

Sign it with your own certificate (for a test machine, a self-signed one whose subject is the publisher, trusted in `LocalMachine\TrustedPeople`):

```
signtool sign /fd SHA256 /f cert.pfx /p password app.msix
Add-AppxPackage -Path app.msix
```

The app then has a Start-menu entry, its own identity and an entry in Settings > Apps; `Remove-AppxPackage` removes it. A packaged app is a full-trust desktop app: it keeps the tray icon, the global hotkeys and the file dialogs of an unpackaged one. Installing through a remote shell session fails with access denied; install from the user's own desktop session. Signing with a certificate from a certificate authority, and the Store, are outside this tool.

## Set up signing once

Signing is configured once; after that every `package` and `install` signs. Each setting comes from, first found wins: a flag, an environment variable, a project property, the per-user file `signing.json` (`~/.config/oneapp/`, `~/Library/Application Support/oneapp/`, `%APPDATA%\oneapp\`; `ONEAPP_SIGNING_CONFIG` names another file; paths in it are relative to it). The certificate password comes from the environment or that file only, never from the project. A project that is checked in carries only `<OneAppSignIdentity>`, `<OneAppCertificate>` (a path relative to the project), `<OneAppCertificateThumbprint>` and `<OneAppTimestampUrl>`.

Example `signing.json` (every key optional):

```json
{ "identity": "Developer ID Application: Name (TEAMID)", "notaryKey": "AuthKey_ABC123.p8", "notaryKeyId": "ABC123", "notaryIssuer": "69a6de70-0000-0000-0000-000000000000",
  "certificate": "codesign.pfx", "password": "...", "timestampUrl": "http://timestamp.digicert.com" }
```

### macOS: sign and notarize

- **Sign:** `--identity` / `ONEAPP_SIGN_IDENTITY` / `identity` is a Developer ID Application certificate in your keychain. Without one the bundle is signed ad hoc, and `oneapp` prints that it was not notarized.
- **Notarize:** create an App Store Connect API key (Users and Access, Integrations; role Developer) and keep the `.p8` file. Set the key file (`--notary-key` / `ONEAPP_NOTARY_KEY` / `notaryKey`), the key id (`--notary-key-id` / `ONEAPP_NOTARY_KEY_ID` / `notaryKeyId`) and the issuer id (`--notary-issuer` / `ONEAPP_NOTARY_ISSUER` / `notaryIssuer`). `oneapp install --dmg` then runs `xcrun notarytool submit FILE --key … --key-id … --issuer … --wait`, and on acceptance `xcrun stapler staple` on the image and the bundle. `--no-notarize` skips it.
- **Errors** (exit code 1 or 2, JSON `error.code`): `notary_incomplete` names the missing settings, `notary_key_missing`, `notary_needs_identity`, `notarize_failed` (tool missing, credentials refused), `notarize_rejected` (carries Apple's submission id and log), `staple_failed`.

### Windows: sign the MSIX

Windows installs only signed packages, and the publisher in the manifest must equal the certificate's subject (`publisher_mismatch` otherwise; with a certificate configured `--publisher` may be left out and the subject is used). Pick one way to sign:

- **A .pfx file** (`--cert` / `ONEAPP_WINDOWS_CERT` / `OneAppCertificate` / `certificate`, password in `ONEAPP_WINDOWS_CERT_PASSWORD` or `password`). Signed by `oneapp` itself, in managed code, so it works when packaging on Linux or macOS too. RSA and ECDSA keys; the certificate needs the Code Signing usage.
- **A certificate in the Windows store** (`--cert-thumbprint` / `ONEAPP_WINDOWS_CERT_THUMBPRINT` / `thumbprint`): the current user's or the computer's personal store, on Windows only (`cert_store_unavailable` elsewhere).
- **Microsoft's cloud signing service** (Azure Trusted Signing, now Artifact Signing), where the certificate never leaves the service. Following Microsoft's documentation: create a signing account and a certificate profile (public trust for a published app), install the Windows SDK's `signtool` (10.0.2261 or newer) and Microsoft's client tools (`winget install -e --id Microsoft.Azure.ArtifactSigningClientTools`), give your identity the "Signer" role on the account and sign in the way the service documents (`az login`, or the `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` variables). Then set the endpoint (`--cloud-endpoint` / `ONEAPP_CLOUD_SIGN_ENDPOINT` / `cloudEndpoint`, such as `https://eus.codesigning.azure.net`), the account (`--cloud-account` / `ONEAPP_CLOUD_SIGN_ACCOUNT` / `cloudAccount`) and the profile (`--cloud-profile` / `ONEAPP_CLOUD_SIGN_PROFILE` / `cloudProfile`). `oneapp` writes the metadata file and runs `signtool sign /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib Azure.CodeSigning.Dlib.dll /dmdf metadata.json FILE`; it references no package for this. Pass the profile's subject as `--publisher` (or `OneAppPublisher`), since the certificate is not on this machine. It runs on Windows only (`cloud_sign_unavailable`). `ONEAPP_SIGNTOOL` and `ONEAPP_CLOUD_SIGN_DLIB` name the two files when they are not found in the SDK folder and in `%LOCALAPPDATA%\Microsoft\MicrosoftArtifactSigningClientTools`.
- **Timestamp:** `--timestamp-url` / `ONEAPP_TIMESTAMP_URL` / `timestampUrl` (an RFC 3161 service). Without one the signature stops being valid when the certificate expires, and `oneapp` says so.
- **Errors:** `cert_missing`, `cert_password`, `cert_no_key`, `cert_expired`, `cert_not_code_signing`, `cert_not_found`, `cert_conflict` (more than one way set), `cloud_sign_incomplete`, `bad_cloud_endpoint`, `signtool_missing`, `cloud_dlib_missing`, `cloud_sign_failed` (with signtool's message), `timestamp_failed`.

For a test machine, a self-signed certificate whose subject is the publisher works if it is added to the computer's *Trusted People* store (and, for `signtool verify`, *Root*).

## Installing on Windows

`oneapp install <project>` installs for the current user, no administrator rights, and `oneapp uninstall <app id>` removes it.

- **With a certificate configured** it builds the signed MSIX and runs `Add-AppxPackage`: a Start-menu entry, an entry in Settings > Apps, its own identity, clean removal. The certificate has to be trusted on the machine (a certificate from a certificate authority is; a self-signed one needs Trusted People). Install from the user's own desktop session; over a remote shell Windows answers access denied.
- **Without one** there is no package, because Windows will not install an unsigned one. The files go to `%LOCALAPPDATA%\Programs\<app id>`, a shortcut to the Start menu's Programs folder and an Uninstall entry under `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\<app id>`, which is what a classic per-user installer writes: Windows lists the app in the Start menu and in Settings > Apps, and its Uninstall button runs the `uninstall.ps1` next to the program. The icon is the `OneAppIcon` PNG (256 pixels or smaller). `--unpackaged` forces this path even when a certificate is configured. The app has no package identity this way, so features that need one (packaged toast notifications with actions) behave as in an unpackaged app.
