Back to Skiasharp

NuGet Packages

documentation/packages.md

3.119.216.0 KB
Original Source

NuGet Packages

Reference for all NuGet packages produced by SkiaSharp — purpose, contents, and usage guidance.

Related: Adding Libraries | Architecture | Linux Assets

Contents


Core Managed Packages

These contain the managed C# assemblies. The SkiaSharp and HarfBuzzSharp core packages automatically include the appropriate NativeAssets for most platforms (see Auto-Included NativeAssets). For Linux, WebAssembly, NanoServer, and WinUI you must add the NativeAssets package manually.

PackageDescription
SkiaSharpCross-platform 2D graphics API. Managed C# bindings to Google's Skia library. Core types: SKCanvas, SKPaint, SKBitmap, SKImage, SKPath, SKSurface. Includes .NET Interactive support (embedded DLL for Polyglot Notebooks).
HarfBuzzSharpManaged C# bindings to the HarfBuzz text shaping engine. Provides Buffer, Font, Face for complex text layout.
SkiaSharp.HarfBuzzIntegration bridge — adds HarfBuzz text shaping to SkiaSharp via SKShaper. Depends on both SkiaSharp and HarfBuzzSharp.
SkiaSharp.SkottieLottie/Bodymovin animation playback. Renders After Effects animations. Depends on SkiaSharp, SkiaSharp.SceneGraph, and SkiaSharp.Resources.
SkiaSharp.SceneGraphScene graph API for complex rendering pipelines. Depends on SkiaSharp. Used by Skottie internally.
SkiaSharp.ResourcesResource provider implementations. Depends on SkiaSharp. Used by Skottie for asset loading.

Views Packages

Platform-specific UI controls for rendering SkiaSharp content. These provide ready-to-use views/controls that handle the platform-specific rendering surface setup.

PackageDescription
SkiaSharp.ViewsPlatform views for iOS, tvOS, macOS, Mac Catalyst, Android, and Tizen. Provides SKCanvasView and SKGLView.
SkiaSharp.Views.Desktop.CommonCommon base classes for desktop views (netstandard2.0+, net462+).
SkiaSharp.Views.WindowsFormsWindows Forms controls: SKControl, SKGLControl. net462+ and net6.0-windows+. Depends on OpenTK.
SkiaSharp.Views.WPFWPF control: SKElement. net462+ and net6.0-windows+. Depends on OpenTK.
SkiaSharp.Views.WinUIWinUI 3 controls: SKXamlCanvas, SKSwapChainPanel. net6.0-windows+. Depends on Microsoft.WindowsAppSDK. Auto-includes SkiaSharp.NativeAssets.WinUI.
SkiaSharp.Views.Gtk3GTK# 3 control: SKDrawingArea. netstandard2.0+. For Linux desktop apps. Depends on GtkSharp.
SkiaSharp.Views.BlazorBlazor WebAssembly controls: SKCanvasView, SKGLView. net6.0+. Auto-includes SkiaSharp.NativeAssets.WebAssembly.
SkiaSharp.Views.Maui.Core.NET MAUI shared view infrastructure. net8.0+. Depends on Microsoft.Maui.Core.
SkiaSharp.Views.Maui.Controls.NET MAUI controls: SKCanvasView, SKGLView. net8.0+. Depends on SkiaSharp.Views.Maui.Core and Microsoft.Maui.Controls.
SkiaSharp.Views.Uno.WinUIUno Platform controls: SKXamlCanvas, SKSwapChainPanel. net8.0+. Depends on Uno.WinUI. Auto-includes SkiaSharp.NativeAssets.WebAssembly for WASM targets and SkiaSharp.Views.WinUI for Windows targets.

GPU Backend Packages

Optional packages for hardware-accelerated rendering via specific GPU APIs.

PackageDescription
SkiaSharp.Vulkan.SharpVkVulkan GPU backend. netstandard2.0+, net462+, net6.0+. Depends on SharpVk 0.4.2.
SkiaSharp.Direct3D.VorticeDirect3D 12 GPU backend. net8.0 only. Windows-only due to Vortice.Direct3D12 3.5.0 dependency.

Native Assets

Each platform has a pair of NativeAssets packages containing pre-built native binaries:

  • SkiaSharp.NativeAssets.{Platform} — contains libSkiaSharp
  • HarfBuzzSharp.NativeAssets.{Platform} — contains libHarfBuzzSharp

Both follow the same platform matrix and architectures. HarfBuzzSharp does not have Linux.NoDependencies, NanoServer, or WinUI variants.

Important: Library projects should depend on SkiaSharp only. NativeAssets packages belong in the application (executable) project so the correct binary is deployed. See Deployment & Containers.

Platform Packages

PackageDescription
SkiaSharp.NativeAssets.Win32
HarfBuzzSharp.NativeAssets.Win32Windows (x64, x86, arm64). Auto-included.
SkiaSharp.NativeAssets.macOS
HarfBuzzSharp.NativeAssets.macOSmacOS universal binary (Intel + Apple Silicon). Auto-included.
SkiaSharp.NativeAssets.Linux
HarfBuzzSharp.NativeAssets.LinuxLinux (x64, x86, arm, arm64, riscv64, loongarch64). Both glibc and musl (Alpine) variants. Must add manually. Requires fontconfig (libfontconfig.so.1) for system font enumeration.
SkiaSharp.NativeAssets.Linux.NoDependenciesLinux (same architectures as above, glibc + musl). SkiaSharp only. Must add manually. No fontconfig, no third-party deps — only requires libc/libm/libpthread/libdl. Designed for minimal containers. Fonts must be loaded explicitly.
SkiaSharp.NativeAssets.NanoServerWindows Nano Server containers (x64 only). SkiaSharp only. Must add manually.
SkiaSharp.NativeAssets.WinUIANGLE rendering surface for WinUI 3 apps (x64, x86, arm64). SkiaSharp only. Contains SkiaSharp.Views.WinUI.Native.dll, libEGL.dll, and libGLESv2.dll for hardware-accelerated OpenGL ES — this is not a Skia binary. Auto-included by SkiaSharp.Views.WinUI.
SkiaSharp.NativeAssets.Android
HarfBuzzSharp.NativeAssets.AndroidAndroid (x86, x64, arm, arm64). Auto-included.
SkiaSharp.NativeAssets.iOS
HarfBuzzSharp.NativeAssets.iOSiOS framework bundle (arm64 device + simulator). Auto-included.
SkiaSharp.NativeAssets.MacCatalyst
HarfBuzzSharp.NativeAssets.MacCatalystMac Catalyst universal framework bundle. Auto-included.
SkiaSharp.NativeAssets.tvOS
HarfBuzzSharp.NativeAssets.tvOSApple tvOS framework bundle (arm64, device only). Auto-included.
SkiaSharp.NativeAssets.Tizen
HarfBuzzSharp.NativeAssets.TizenSamsung Tizen (armel, x86). Auto-included.
SkiaSharp.NativeAssets.WebAssembly
HarfBuzzSharp.NativeAssets.WebAssemblyEmscripten static library (.a). Static linking, not P/Invoke — linked into dotnet.wasm at build time via MSBuild NativeFileReference. Includes multiple Emscripten versions with threading (st/mt) and SIMD variants. Must add manually (or use SkiaSharp.Views.Blazor / SkiaSharp.Views.Uno.WinUI).

⚠️ WASM is NOT dynamic loading. Unlike all other platforms, WebAssembly uses static linking at compile time. The .a files are passed to the Emscripten linker which embeds them into the final dotnet.wasm binary. DllImport("libSkiaSharp") still works — the .NET WASM runtime resolves it to statically linked symbols.

Unity WebGL: Unity WebGL also uses Emscripten. While not officially supported, the same static linking principle applies. Unity-specific integration may require manual configuration beyond the standard NativeFileReference approach.

Auto-Included NativeAssets

The core SkiaSharp and HarfBuzzSharp packages automatically include NativeAssets for most platforms via TFM-conditional dependencies:

PackagesAuto-included when targeting
SkiaSharp.NativeAssets.Win32
HarfBuzzSharp.NativeAssets.Win32Windows TFM (net8.0-windows) or non-platform TFM (net6.0, net8.0, netstandard2.0, netstandard2.1, net462)
SkiaSharp.NativeAssets.macOS
HarfBuzzSharp.NativeAssets.macOSmacOS TFM (net8.0-macos) or non-platform TFM (net6.0, net8.0, netstandard2.0, netstandard2.1, net462)
SkiaSharp.NativeAssets.Android
HarfBuzzSharp.NativeAssets.AndroidAndroid TFM (net8.0-android)
SkiaSharp.NativeAssets.iOS
HarfBuzzSharp.NativeAssets.iOSiOS TFM (net8.0-ios)
SkiaSharp.NativeAssets.MacCatalyst
HarfBuzzSharp.NativeAssets.MacCatalystMac Catalyst TFM (net8.0-maccatalyst)
SkiaSharp.NativeAssets.tvOS
HarfBuzzSharp.NativeAssets.tvOStvOS TFM (net8.0-tvos)
SkiaSharp.NativeAssets.Tizen
HarfBuzzSharp.NativeAssets.TizenTizen TFM (net8.0-tizen)

Must be added manually (not auto-included):

  • SkiaSharp.NativeAssets.Linux / HarfBuzzSharp.NativeAssets.Linux — for Linux server/desktop
  • SkiaSharp.NativeAssets.Linux.NoDependencies — for minimal Linux containers (SkiaSharp only)
  • SkiaSharp.NativeAssets.WebAssembly / HarfBuzzSharp.NativeAssets.WebAssembly — for Blazor/Uno WASM. SkiaSharp.NativeAssets.WebAssembly is auto-included by SkiaSharp.Views.Blazor and SkiaSharp.Views.Uno.WinUI; HarfBuzzSharp.NativeAssets.WebAssembly must always be added manually.
  • SkiaSharp.NativeAssets.NanoServer — for Windows Nano Server (SkiaSharp only)
  • SkiaSharp.NativeAssets.WinUI — for WinUI 3 apps (SkiaSharp only; auto-included by SkiaSharp.Views.WinUI)

Linux Package Selection Guide

ScenarioPackageWhy
Standard Linux server/desktopSkiaSharp.NativeAssets.LinuxFull fontconfig integration for system font access
Docker containers (Debian/Ubuntu)SkiaSharp.NativeAssets.Linux.NoDependenciesNo system library dependencies beyond glibc
Alpine Docker containersSkiaSharp.NativeAssets.Linux.NoDependenciesIncludes linux-musl-* variants, no deps
Minimal/distroless containersSkiaSharp.NativeAssets.Linux.NoDependenciesZero third-party deps
App needs system font enumerationSkiaSharp.NativeAssets.LinuxFontconfig required for SKFontManager system fonts

Deployment & Containers

Application vs Library References

NativeAssets packages must be referenced in the application project (the one that produces the executable), not in library projects. The .NET runtime resolves native binaries from the application's output directory using runtime identifiers (RIDs).

If a NativeAssets package is only referenced in a transitive library, the native binary may not be copied to the final output — causing DllNotFoundException at runtime.

Container Deployment

For containers, use SkiaSharp.NativeAssets.Linux.NoDependencies unless you specifically need fontconfig for system font enumeration. This package has zero third-party dependencies and works in minimal base images (mcr.microsoft.com/dotnet/aspnet, Alpine, distroless).

Publishing Modes

ModeNative Binary Handling
Framework-dependentBinaries in runtimes/{rid}/native/ resolved at runtime
Self-containedBinaries copied to publish output for the specified RID
Single-fileBinaries extracted alongside the executable at runtime

Obsolete Packages

These packages are no longer actively maintained. Use the listed replacement.

PackageReplacement
SkiaSharp.NativeAssets.UWPSkiaSharp.NativeAssets.WinUI
SkiaSharp.NativeAssets.watchOS(none — watchOS not supported)
HarfBuzzSharp.NativeAssets.UWPHarfBuzzSharp.NativeAssets.Win32
HarfBuzzSharp.NativeAssets.watchOS(none)
SkiaSharp.Views.NativeAssets.UWPSkiaSharp.Views.WinUI
SkiaSharp.Views.FormsSkiaSharp.Views.Maui.Controls
SkiaSharp.Views.Forms.WPFSkiaSharp.Views.WPF
SkiaSharp.Views.Forms.GTKSkiaSharp.Views.Gtk3
SkiaSharp.Views.Gtk2SkiaSharp.Views.Gtk3
SkiaSharp.Views.UnoSkiaSharp.Views.Uno.WinUI
SkiaSharp.Views.Maui.Controls.CompatibilitySkiaSharp.Views.Maui.Controls

Troubleshooting: Native Loading

Understanding DllNotFoundException on Linux

On Linux, DllNotFoundException errors from dlopen() have two distinct failure modes with different root causes:

Error patternWhat happenedFix
libSkiaSharp.so: cannot open shared object file: No such file or directoryThe .so file was not found at any search pathAdd SkiaSharp.NativeAssets.Linux (or .NoDependencies) as a PackageReference in the executable project, not a library
libfontconfig.so.1: cannot open shared object file (or another dependency OF libSkiaSharp)A .so was found and loaded, but it has a dependency that isn't installedEither install the missing library (e.g. fontconfig) or switch to NoDependencies (see below)

Wrong Binary Deployed

SkiaSharp.NativeAssets.Linux.NoDependencies ships a .so with zero external dependencies — only libc/libm/libpthread/libdl. If you reference NoDependencies but see errors about missing fontconfig, uuid, or other libraries:

  1. The binary being loaded is not from NoDependencies — it's from NativeAssets.Linux (or another source)
  2. Check for a transitive SkiaSharp.NativeAssets.Linux reference conflicting with NoDependencies
  3. Check that NoDependencies is in the executable project (not a library project)
  4. Check your container build tool (e.g. .NET Aspire, Docker SDK) — it may deploy the wrong RID variant

You can verify which binary is loaded by running ldd on the libSkiaSharp.so in your publish output. The NoDependencies variant will show only libc/libm/libpthread/libdl.

Reading .NET Native Loading Errors

The .NET runtime tries multiple paths to load a native library and reports ALL failures. Focus on the first error — subsequent lines are fallback attempts:

System.DllNotFoundException: Unable to load shared library 'libSkiaSharp'
  libfontconfig.so.1: cannot open shared object file     ← LOOK HERE (binary found, dependency missing)
  /usr/share/dotnet/.../libSkiaSharp.so: cannot open      ← fallback path, file not found
  /app/liblibSkiaSharp.so: cannot open                    ← fallback path, file not found

Container Deployment Checklist

ProblemCauseFix
DllNotFoundException: libSkiaSharpNative binary not in outputAdd NativeAssets.Linux.NoDependencies (or .Linux) as a direct PackageReference in the application project
libfontconfig.so.1: cannot openUsing NativeAssets.Linux in a minimal containerSwitch to NoDependencies, or install fontconfig in your Dockerfile
Wrong binary for container archRID mismatch (glibc vs musl)Alpine needs linux-musl-* RIDs — NoDependencies includes both glibc and musl variants
Trimming removes native deps.NET trimmer strips unused assembliesAdd the NativeAssets package as a direct PackageReference