Optris.StaticGraphics.Avalonia.Vulkan 3.119.4.1

dotnet add package Optris.StaticGraphics.Avalonia.Vulkan --version 3.119.4.1
                    
NuGet\Install-Package Optris.StaticGraphics.Avalonia.Vulkan -Version 3.119.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Optris.StaticGraphics.Avalonia.Vulkan" Version="3.119.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Optris.StaticGraphics.Avalonia.Vulkan" Version="3.119.4.1" />
                    
Directory.Packages.props
<PackageReference Include="Optris.StaticGraphics.Avalonia.Vulkan" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Optris.StaticGraphics.Avalonia.Vulkan --version 3.119.4.1
                    
#r "nuget: Optris.StaticGraphics.Avalonia.Vulkan, 3.119.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Optris.StaticGraphics.Avalonia.Vulkan@3.119.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Optris.StaticGraphics.Avalonia.Vulkan&version=3.119.4.1
                    
Install as a Cake Addin
#tool nuget:?package=Optris.StaticGraphics.Avalonia.Vulkan&version=3.119.4.1
                    
Install as a Cake Tool

Optris.StaticGraphics.Avalonia

Static native libraries for Avalonia single-file NativeAOT publishing: SkiaSharp, HarfBuzzSharp and (on Windows) ANGLE, linked into the executable so nothing has to be shipped beside it.

Fork of greepar/StaticLink.Avalonia (MIT).

Pick a tier

The package ships in three tiers. Each is a strict superset of the one below it, so no tier can leave a hole in an Avalonia render-backend fallback chain.

Package Backends compiled into Skia Approximate cost
Optris.StaticGraphics.Avalonia.Vulkan Vulkan (Metal on macOS), OpenGL/ANGLE, Software largest
Optris.StaticGraphics.Avalonia.OpenGL OpenGL/ANGLE, Software no Vulkan
Optris.StaticGraphics.Avalonia.Software Software smallest, no GPU

Reference exactly one of them. Referencing two fails the build (OSG0001): both ship the same static libraries and the same DirectPInvoke names, so the linker would pick one and the app would silently ship the other tier's capabilities.

On macOS the Vulkan tier is delivered by Metal. Skia does not vendor MoltenVK, so Vulkan cannot reach Apple GPUs; Metal is what Avalonia asks for there anyway.

<PackageReference Include="Optris.StaticGraphics.Avalonia.Vulkan" Version="4.150.1.1" />

For macOS also reference Optris.StaticGraphics.AvaloniaNative, which is tier-independent but must match your Avalonia version because it contains libAvaloniaNative.a.

<PackageReference Include="Optris.StaticGraphics.AvaloniaNative" Version="12.1.1.1" />

Publish

dotnet publish -c Release -r win-x64 \
  -p:PublishAot=true \
  -p:SelfContained=true \
  -p:PublishSingleFile=true \
  -p:StripSymbols=true

Use the RID you need: win-x64, win-x86, win-arm64, linux-x64, linux-arm64, linux-musl-x64, linux-musl-arm64, osx-x64 or osx-arm64.

What the package tells you

The tier is published as MSBuild properties, generated when the package was packed:

Property Example
OptrisStaticGraphicsTier Vulkan
OptrisStaticGraphicsBackends Vulkan;OpenGL;Software
OptrisStaticGraphicsHasVulkan true
OptrisStaticGraphicsHasAngle true
OptrisStaticGraphicsAngleBranch 7922 (empty when the tier has no ANGLE)

Build-time guards

Set what your app cannot run without, and a wrong tier fails the build instead of the window:

<PropertyGroup>
  <OptrisStaticGraphicsRequiredBackends>Vulkan</OptrisStaticGraphicsRequiredBackends>
</PropertyGroup>
Code Meaning
OSG0001 (error) Two tier packages referenced, or the linked tier lacks a required backend.
OSG0002 (warning) A reduced tier (anything below Vulkan) is linked. Set OptrisStaticGraphicsAcknowledgeReducedTier=true once that is deliberate.
OSG0003 (warning) PublishAot with a RID this package carries no payload for: nothing is linked statically.

Runtime guard

Skia does not fail when a backend is missing. gr_direct_context_make_vulkan is compiled in whatever the build flags say and simply returns null when Vulkan was not enabled, so an app that asks for Vulkan creates a Vulkan instance, a device and a queue, hands them to Skia, gets nothing back, and renders a blank window with no crash, no log and no fallback. Metal behaves the same way on macOS.

WithOptrisStaticGraphics() compares the rendering modes the app configured against the tier that is actually linked:

using Optris.StaticGraphics;

public static AppBuilder BuildAvaloniaApp() =>
    AppBuilder.Configure<App>()
        .UsePlatformDetect()
        .With(new Win32PlatformOptions
        {
            RenderingMode = [Win32RenderingMode.Vulkan, Win32RenderingMode.AngleEgl, Win32RenderingMode.Software],
        })
        .WithOptrisStaticGraphics()   // OptrisBackendPolicy.Strict by default
        .LogToTrace();
  • OptrisBackendPolicy.Strict throws at startup, naming the tier, the mode and the package that would provide it.
  • OptrisBackendPolicy.Filter removes the unavailable modes and logs to LogArea.Platform, which repairs the fallback chain: a tier-OpenGL app that asks for Vulkan first gets a working ANGLE window instead of a blank one.

Chain it after the windowing subsystem is selected and after the .With(...) call that configures the platform options, because it inspects those options in place. Avalonia builds its own default options when an app configures none, and there is no supported way to reach into that default, so the guard can only report it: configure the options explicitly if you want them repaired.

The guard is compiled into your project by the package. It is injected when Avalonia.Desktop is referenced, because it inspects Win32PlatformOptions, X11PlatformOptions and AvaloniaNativePlatformOptions. Set OptrisStaticGraphicsInjectRuntimeGuard to true or false to override that, for example when those packages arrive transitively.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.119.4.1 84 8/31/2026