Skip to content

Fix WinUI Projection DLL not resolved for .NET 9 consumers on Windows#4084

Merged
mattleibow merged 1 commit into
mainfrom
mattleibow/issue-4082-bug-3-119-4-and-4-147-0-preview-3-1-do-17d09a
May 29, 2026
Merged

Fix WinUI Projection DLL not resolved for .NET 9 consumers on Windows#4084
mattleibow merged 1 commit into
mainfrom
mattleibow/issue-4082-bug-3-119-4-and-4-147-0-preview-3-1-do-17d09a

Conversation

@mattleibow

@mattleibow mattleibow commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4082SkiaSharp.Views.WinUI.Native.Projection assembly not found at runtime on Windows for .NET 9 apps (v3.119.4+).

Root Cause

When the primary TFM moved from net8.0 to net10.0 (TFMCurrent), the NativeAssetPackageFile entries in SkiaSharp.NativeAssets.WinUI.csproj placed the Projection DLL only into:

runtimes/win-{arch}/lib/net10.0-windows10.0.19041.0/

NuGet's TFM resolution won't serve a net10.0 asset to a net9.0 consumer (higher TFM isn't backward-compatible), so .NET 9 apps get a FileNotFoundException at runtime.

In v3.119.2 (TFMCurrent=net8.0): The DLL was in runtimes/win-{arch}/lib/net8.0-windows10.0.19041.0/ — accessible to both net8 and net9 consumers.

Fix

Include the Projection DLL in all supported Windows TFM folders (WindowsTargetFrameworksCurrent and WindowsTargetFrameworksPrevious), so the NuGet package serves it to both .NET 9 and .NET 10 consumers.

Resulting package layout:

runtimes/win-x64/lib/net10.0-windows10.0.19041.0/SkiaSharp.Views.WinUI.Native.Projection.dll
runtimes/win-x64/lib/net9.0-windows10.0.19041.0/SkiaSharp.Views.WinUI.Native.Projection.dll
runtimes/win-x64/native/SkiaSharp.Views.WinUI.Native.dll
(same pattern for win-x86 and win-arm64)

Testing

  • iOS/Android unaffected (they don't use the WinUI Projection)
  • Windows .NET 9: Projection DLL now found via net9.0-windows folder
  • Windows .NET 10: Projection DLL found via net10.0-windows folder

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4084

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4084"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4084/packages --name skiasharp-pr-4084
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4084

The NativeAssets.WinUI package placed the Projection DLL only in the
net10.0-windows folder (WindowsTargetFrameworksCurrent). Since NuGet
won't serve a higher TFM asset to a lower TFM consumer, .NET 9 apps
couldn't resolve the assembly at runtime, causing FileNotFoundException.

Fix by including the Projection DLL in ALL supported TFMs (both Current
and Previous), ensuring every consumer TFM gets the assembly. This
mirrors the pattern where lib/ placeholders exist for each TFM.

Fixes #4082

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the mattleibow/issue-4082-bug-3-119-4-and-4-147-0-preview-3-1-do-17d09a branch from 1bf2911 to 8f542ce Compare May 27, 2026 23:38
@mattleibow mattleibow changed the title Fix WinUI Projection DLL not found for .NET 9 consumers Fix WinUI Projection DLL not resolved for .NET 9 consumers on Windows May 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

@mattleibow
mattleibow merged commit 216be8e into main May 29, 2026
6 checks passed
@mattleibow
mattleibow deleted the mattleibow/issue-4082-bug-3-119-4-and-4-147-0-preview-3-1-do-17d09a branch May 29, 2026 17:07
mattleibow added a commit that referenced this pull request May 29, 2026
[3.119.x] Fix WinUI Projection DLL not resolved for .NET 9 consumers on Windows (#4086)

Fixes: #4082
Cherry-pick of: #4084

Backport of the same fix to the 3.119.x release branch. The Projection DLL
was only placed in `runtimes/win-{arch}/lib/net10.0-windows10.0.19041.0/`,
which NuGet won't serve to net9 consumers. .NET 9 apps hit a
`FileNotFoundException` for `SkiaSharp.Views.WinUI.Native.Projection` at
startup.

Include the Projection DLL in both the `$(WindowsTargetFrameworksCurrent)`
(net10.0) and `$(WindowsTargetFrameworksPrevious)` (net9.0) runtime folders
so NuGet resolves it for both .NET 9 and .NET 10 consumers.

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow added this to the 4.148.0-rc.1 milestone Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] 3.119.4 and 4.147.0-preview 3.1 do not work on Windows

1 participant