--- uid: Uno.Skia.Desktop --- # Using the Skia Desktop Uno Platform supports running applications using a common Skia Desktop shell, which is automatically used based on the running platform, using a single build output using the `net10.0-desktop` target framework from the [Uno.Sdk](xref:Uno.Features.Uno.Sdk). The currently supported targets and platforms are: - Linux X11 - [Linux Framebuffer](xref:Uno.Skia.Linux.Framebuffer) - Windows (Using Win32 shell) - [macOS (Using an AppKit shell)](xref:Uno.Skia.macOS) The set of supported platforms can be defined by using the `UnoPlatformHostBuilder`, introduced in Uno Platform 5.2 and the [Single Project support](xref:Uno.Development.MigratingToSingleProject). ## Get started with the Skia Desktop head Follow the getting started guide for [VS Code](xref:Uno.GetStarted.vscode) or [Visual Studio](xref:Uno.GetStarted.vs2022), making sure to use the latest Uno Platform templates. Once created, in the `Platforms/Desktop/Program.cs` file, you'll find the following builder: ```csharp var host = UnoPlatformHostBuilder.Create() .App(() => new App()) .UseX11() .UseLinuxFrameBuffer() .UseMacOS() .UseWin32() .Build(); host.Run(); ``` This builder allows us to configure the SkiaHost and setup which platforms will be supported at runtime. The builder evaluates the platform's availability one by one, in the order of definition. ### Additional setup #### [**Linux**](#tab/linux) [!include[linux-setup](../includes/additional-linux-setup-inline.md)] --- ### Troubleshooting OpenGL integration Enabling debug logging messages for the Skia Host can help diagnose the render surface type selection. In your `App.xaml.cs` file, change the minimum log level to: ```csharp builder.SetMinimumLevel(LogLevel.Debug); ``` Then change the logging level of the Skia Host to `Information` or `Debug`: ```csharp builder.AddFilter("Uno.UI.Runtime.Skia", LogLevel.Information); ``` You may also need to initialize the logging system earlier than what is found in Uno.UI's default templates by calling this in `Main`: ```csharp YourAppNamespace.App.ConfigureFilters(); // Enable tracing of the Skia host ``` ## Upgrading to a later version of SkiaSharp By default, Uno Platform comes with a set of **SkiaSharp** dependencies. If you want to upgrade **SkiaSharp** to a later version, you'll need to specify all packages individually in your project as follows: ```xml ``` ## Rendering Backend Selection By default, Uno Platform uses OpenGL for hardware-accelerated rendering on desktop, with an automatic fallback to software rendering. You can override this per platform using the host builder: ```csharp var host = UnoPlatformHostBuilder.Create() .App(() => new App()) .UseX11(b => b.RenderingBackend(X11RenderingBackend.Vulkan)) .UseWin32(b => b.RenderingBackend(Win32RenderingBackend.Vulkan)) .UseMacOS() .Build(); ``` Each platform exposes its own `RenderingBackend` enum with only the backends it supports. For details, see [Vulkan Rendering Backend](xref:Uno.Skia.Vulkan). Alternatively, you can use `FeatureConfiguration.Rendering` flags for backwards compatibility. The builder API takes precedence when both are used. ## Windows Specifics ### RDP Hardware Acceleration The Uno Platform Skia Desktop runtime on Windows uses a WPF shell internally. By default, Uno Platform enables RDP hardware acceleration in order to get good performance, yet this feature is disabled by default in standard WPF apps with .NET 8. If you're having issues with the Windows support for Skia Desktop over RDP, add the following to your project: ```xml ``` ## X11 Specifics When running using X11 Wayland compatibility (e.g. recent Ubuntu releases), DPI scaling cannot be determined in a reliable way. In order to specify the scaling to be used by Uno Platform, set the `UNO_DISPLAY_SCALE_OVERRIDE` environment variable. The default value is `1.0`. The X11 support uses DBus for various interactions with the system, such as file selection. Make sure that dbus is installed. ## .NET Native AOT support Building an Uno Platform Skia Desktop app with .NET (7+) Native AOT requires Uno Platform 4.7 (or later). To build an app with this feature enabled: 1. Add the following property in your `.csproj`: ```xml true ``` 1. Add the following items in your `.csproj`: ```xml ``` 1. Build your app with: ```dotnetcli dotnet publish -c Release -f net10.0-desktop ``` > [!NOTE] > Cross-compilation support is not supported as of .NET 7. To build a Native AOT app for Linux or Mac, you'll need to build on the corresponding host. > [!NOTE] > .NET Native AOT on Windows is not yet supported as WPF does not support it at this time. ### Automatic Binding Preservation When building an Uno Platform application head (for example, a Skia Desktop head) with Native AOT, Uno Platform automatically preserves public properties of types referenced by `[Bindable]` types to ensure data binding works correctly at runtime. This happens automatically when both `IsUnoHead=true` and `PublishAot=true` are set on the project (Uno head templates set `IsUnoHead` for you). > [!NOTE] > Automatic binding preservation is only available for Uno Platform application heads. Class libraries or other projects that set `PublishAot=true` but are not marked with `IsUnoHead=true` will not get this behavior. The build system: 1. Finds all types marked with `Microsoft.UI.Xaml.Data.BindableAttribute` or `Uno.Extensions.Reactive.Bindings.BindableAttribute` 2. Discovers types referenced by public properties of those bindable types 3. Generates an ILLink descriptor file to preserve the public properties (getters/setters) of discovered types For example, if you have: ```csharp [Bindable] public class MainViewModel { public Entity MyEntity { get; set; } } public record Entity(string Name); ``` The build system will automatically preserve the `Name` property of `Entity`, allowing `{Binding MyEntity.Name}` expressions to work correctly in Native AOT builds. For more information, see [the runtime documentation](https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/reflection-in-aot-mode.md) and the [.NET Native AOT documentation](https://learn.microsoft.com/dotnet/core/deploying/native-aot/).