doc/articles/uno-publishing-desktop.linux.md
We support creating .snap packages on Ubuntu 20.04 or later.
The following must be installed and configured:
sudo apt-get install -y snapd
sudo snap install core22
sudo snap install multipass
sudo snap install lxd
sudo snap install snapcraft
lxd init --minimal
sudo usermod --append --groups lxd $USER # In order for the current user to use LXD
[!NOTE] In the above script, replace
core22withcore20if building on Ubuntu 20.04, orcore24if building on Ubuntu 24.04. [!NOTE] Docker may interfere with Lxd causing network connectivity issues, for solutions see: https://documentation.ubuntu.com/lxd/en/stable-5.0/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker
To generate a snap file, run the following:
dotnet publish -f net10.0-desktop -p:SelfContained=true -p:PackageFormat=snap
The generated snap file is located in the bin/Release/netX.0-desktop/linux-[x64|arm64]/publish folder.
Uno Platform generates snap manifests in classic confinement mode and a .desktop file by default.
If you wish to customize your snap manifest, you will need to pass the following MSBuild properties:
SnapManifestDesktopFileYou may use absolute or relative (to the .csproj) paths.
The .desktop filename MUST conform to the Desktop File spec.
If you wish, you can generate a default snap manifest and desktop file by running the command above, then tweak them.
[!NOTE] .NET 9 publishing and cross-publishing are not supported as of Uno 5.5, we will support .NET 9 publishing soon.
When building in a CI environment, security restrictions may prevent LXD and Multipass from running properly.
In such cases, and if your environment is built using single-use environments like Azure DevOps Hosted Agents, you can enable the Snap destructive mode with the following parameter to the dotnet publish command:
-p:UnoSnapcraftAdditionalParameters=--destructive-mode
[!IMPORTANT] Using this mode will make destructive changes to your environment, make sure that you will use this mode on a single-use virtual environment (e.g. Docker or Azure DevOps Hosted Agents).
You can install your app on your machine using the following:
sudo snap install MyApp_1.0_amd64.snap --dangerous --classic
You can also publish your app to the Snap store.
[!NOTE] Publishing is a work in progress