diff --git a/doc/articles/uno-publishing-desktop.md b/doc/articles/uno-publishing-desktop.md index 592b331cb71f..9bf8f4b9ad83 100644 --- a/doc/articles/uno-publishing-desktop.md +++ b/doc/articles/uno-publishing-desktop.md @@ -2,50 +2,117 @@ uid: uno.publishing.desktop --- -# Publishing Your App for Desktop +# Publishing Your App For Desktop ## Preparing For Publish -- [Profile your app with VS 2022](https://learn.microsoft.com/en-us/visualstudio/profiling/profiling-feature-tour?view=vs-2022) +- [Profile your app with Visual Studio](https://learn.microsoft.com/en-us/visualstudio/profiling) - [Profile using dotnet-trace and SpeedScope](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace) -## Publish your app - -### Using Visual Studio 2022 - -To publish your app with Visual Studio 2022: +## Publish Using Visual Studio 2022 - In the debugger toolbar drop-down, select the `net8.0-desktop` target framework - Once the project has reloaded, right-click on the project and select **Publish** -- Select the appropriate target for your publication, this example will use the **Folder**, then click **Next** -- Choose an output folder for the published output, then click **Close**. -- In the opened editor, click the **Configuration** "pen" to edit the configuration -- In the opened popup, ensure that **Target Framework** is set to `net8.0-desktop`, then click **Save** -- On the top right, click the **Publish** button -- Once the build is done, the output is located in the publish folder +- Select the **Folder** target for your publication then click **Next** +- Select the **Folder** target again then **Next** +- Choose an output folder then click **Finish** +- The profile is created, you can now **Close** the dialog +- In the opened editor, click `Show all settings` +- Set **Configuration** to `Release` +- Set **Target framework** to `net8.0-desktop` +- You can set **Deployment mode** to either `Framework-dependent` or `Self-contained` + - If `Self-contained` is chosen and you're targeting Windows, **Target runtime** must match the installed .NET SDK runtime identifier + as cross-publishing self-contained WPF apps (e.g. win-x64 to win-arm64) is not supported for now. +- You can set **Target runtime**, make sure it honors the above limitation, if it applies. +- Click **Save** +- Click **Publish** + +## Publish Using The CLI + +On Windows/macOS/Linux, open a terminal in your `csproj` folder and run: + +```shell +dotnet publish -f net8.0-desktop +``` + +If you wish to do a self-contained publish, run the following instead: + +```shell +dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true +``` -Once done, you can head over to the [publishing section](xref:uno.publishing.webassembly#publishing). +Where {{RID}} specifies the chosen OS and Architecture (e.g. win-x64). Again when targeting Windows, cross-publishing is not supported. -### Using the Command Line +### macOS App Bundles -To build your app from the CLI, on Windows, Linux, or macOS: +We now support generating .app bundles on macOS machines. From the CLI run: -- Open a terminal, command line, or powershell -- Navigate to your `csproj` folder -- Publish the app using: +```shell +dotnet publish -f net8.0-desktop -p:PackageFormat=app +``` - ```shell - dotnet publish -f net8.0-desktop -c Release -o ./publish - ``` +You can also do a self-contained publish with: -- Once the build is done, the output is located in the `./publish` folder +```shell +dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageFormat=app +``` -## Publishing +Where {{RID}} is either `osx-x64` or `osx-arm64`. > [!NOTE] -> Work still in progress for publishing to some targets. +> Code signing is planned but not supported yet. + +### Snap Packages + +We support creating .snap packages on **Ubuntu 20.04** or later. + +#### Requirements + +The following must be installed and configured: + +- snapd +- core20 on Ubuntu 20.04 +- core22 on Ubuntu 22.04 +- core24 on Ubuntu 24.04 +- multipass +- lxd + - current user must be part of the `lxd` group + - `lxd init --minimal` or similar should be run +- snapcraft + +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 -Publishing your app can be done through different means: +#### Publishing A Snap -- [ClickOnce](https://learn.microsoft.com/visualstudio/deployment/quickstart-deploy-using-clickonce-folder?view=vs-2022) on Windows -- Using a Zip file, then running the app using `dotnet [yourapp].dll` +To publish a snap, run: + +```shell +dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageFormat=snap +``` + +Where {{RID}} is either `linux-x64` or `linux-arm64`. + +We generate 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: + +- SnapManifest +- DesktopFile + +The .desktop filename MUST conform to the Desktop File spec. + +If you wish, you can generate a default snap manifest and desktop file, then tweak them. + +> [!NOTE] +> .NET 9 publishing and cross-publishing are not supported yet. We will support .NET 9 publishing soon. + +## Limitations + +- NativeAOT is not supported +- R2R is not supported +- Single file publish is not supported + +> [!NOTE] +> Publishing is a work in progress