Shiroka.Avalonia.StaticLink
Static graphics libraries for Avalonia NativeAOT single-file publishing.
This package provides static archives for SkiaSharp, HarfBuzzSharp, and ANGLE, then wires them into MSBuild through buildTransitive targets. It is intended for Avalonia applications that want NativeAOT single-file publish outputs without shipping Avalonia graphics native libraries next to the executable.
Repository: https://github.com/greepar/Avalonia.StaticGraphics
Supported RIDs
win-x64win-arm64linux-x64linux-arm64osx-x64osx-arm64
Included Libraries
Windows:
skia.libSkiaSharp.liblibHarfBuzzSharp.liblibANGLE_static.liblibGLESv2_static.lib
Linux and macOS:
libskia.alibSkiaSharp.alibHarfBuzzSharp.alibANGLE_static.alibGLESv2_static.a
Install
dotnet add package Shiroka.Avalonia.StaticLink
Publish
Windows x64 or arm64:
dotnet publish -c Release -r win-x64 \
-p:PublishAot=true \
-p:SelfContained=true \
-p:PublishSingleFile=true \
-p:StripSymbols=true
Linux x64 or arm64:
dotnet publish -c Release -r linux-x64 \
-p:PublishAot=true \
-p:SelfContained=true \
-p:PublishSingleFile=true \
-p:StripSymbols=true \
-p:LinkerFlavor=lld
macOS x64 or arm64:
dotnet publish -c Release -r osx-arm64 \
-p:PublishAot=true \
-p:SelfContained=true \
-p:PublishSingleFile=true \
-p:StripSymbols=true
The package automatically contributes the static archives as NativeLibrary items when PublishAot=true and the RuntimeIdentifier is supported.
Verify Output
After publishing, the publish directory should not contain Avalonia graphics runtime files such as:
libSkiaSharp.solibHarfBuzzSharp.solibSkiaSharp.dyliblibHarfBuzzSharp.dyliblibSkiaSharp.dlllibHarfBuzzSharp.dllav_libglesv2.dll
The package stores static archives under static/<rid>/native/ inside the NuGet package, so .a and .lib files are used for linking and are not normal runtime assets.
Build From Source
This repository does not depend on 2ndLAB static packages. The GitHub Actions workflow builds the native libraries from upstream source repositories:
- SkiaSharp: https://github.com/mono/SkiaSharp
- ANGLE: https://github.com/google/angle
Build scripts:
scripts/build-linux-static-graphics.shscripts/build-windows-static-graphics.ps1scripts/build-macos-static-graphics.sh
Build locally after the static archives exist:
dotnet pack NuGet/StaticGraphics/Shiroka.Avalonia.StaticLink.csproj -c Release -o artifacts/nuget
The package will be written to:
artifacts/nuget/Shiroka.Avalonia.StaticLink.*.nupkg
GitHub Actions
The workflow .github/workflows/nuget-static-graphics.yml builds all native archives and packs a single NuGet package for all supported RIDs.
It will:
- build Linux x64 static archives on
ubuntu-latest - build Linux arm64 static archives on
ubuntu-24.04-arm - build Windows x64 and arm64 static archives on
windows-latest - build macOS x64 and arm64 static archives on
macos-latest - download all native artifacts into
External/NativeStatic/<rid>/ - run
dotnet pack - upload the generated
.nupkgas a workflow artifact
To publish automatically to nuget.org, add a repository secret named NUGET_API_KEY, then either:
- run the workflow manually with
publish_to_nuget=true - push a tag matching
static-graphics-v*
Example tag:
git tag static-graphics-v3.119.2-7151.4
git push origin static-graphics-v3.119.2-7151.4
Known Runtime Dependencies
Single-file does not always mean dependency-free. Depending on platform and publish settings, the final executable may still depend on operating system libraries and frameworks.
Linux examples:
libc.so.6libm.so.6libstdc++.so.6libgcc_s.so.1libfontconfig.so.1libfreetype.so.6
Linux systems also need usable fonts for text rendering and font fallback.
Scope
This package only covers Avalonia graphics-related native libraries. If your application uses other native dependencies, such as SQLite, audio backends, OpenSSL, or custom native libraries, those dependencies may require separate handling.
License
The NuGet package metadata uses the MIT license. The bundled third-party native libraries are built from their upstream projects and remain subject to their respective upstream licenses.