Skip to content

fix(sdk): Ignore SkiaRenderer in WinAppSDK-only libraries - #25571

Closed
mikernet wants to merge 4 commits into
unoplatform:masterfrom
mikernet:dev/mikernet/sdk-skiarenderer-winappsdk
Closed

mikernet wants to merge 4 commits into
unoplatform:masterfrom
mikernet:dev/mikernet/sdk-skiarenderer-winappsdk

Conversation

@mikernet

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25570

PR Type:

🐞 Bugfix

What changed? 🚀

DisableImplicitUnoWinAppSdkPackages keeps a library's Windows App SDK build free of the base Uno packages. UnoFeatures packages are left in place on purpose, but the legacy SkiaRenderer token is mapped to skia. A library that lists it for its Uno targets therefore still got Uno.WinUI.Graphics2DSK, SkiaSharp.Views.WinUI and, with Toolkit, Uno.Toolkit.Skia.WinUI on Windows. That has two effects:

  • the package becomes a NuGet dependency of the library's Windows group, so WinAppSDK-only consumers get it;
  • a strong-named Windows build no longer has a fully strong-named dependency chain, as Uno assemblies are not strong-named.

Removing the token works on 7.0, where Skia is implied on Uno Platform targets, but the migration guide says it can stay and the library templates add it.

Changes:

  • In a WinAppSDK-only library, SkiaRenderer adds no Skia package on Windows. Uno.Features.targets records when only the token asks for Skia, and the existing strip removes those packages too. The strip is an item condition, so the property counts when set in a Directory.Build.targets. An explicit Skia keeps them, and the library's Uno targets still map SkiaRenderer to Skia. Heads, and libraries without the property, are unchanged, as feat(drawing)!: Factory seams, Skottie in the Skia backend, Svg/Lottie docs #25117 intends.
  • No skia is implied on a single-targeted WinAppSDK project. The check used IsWinAppSdk, which Uno.IsPlatform.props sets before the project body, so it was false when TargetFramework came from the body.
  • Docs: each place that says SkiaRenderer maps to Skia now notes the exception, including the 7.0 migration note. The SKCanvasElement page no longer says the package is referenced on every target.

Behavior change: on 6.7 and 6.8, SkiaRenderer adds Uno.WinUI.Graphics2DSK on Windows. A WinAppSDK-only library (6.7.18+) that compiles SKCanvasElement, SKXamlCanvas or the Toolkit Skia controls on Windows through SkiaRenderer lists Skia.

Follow-up once #25567 lands: the build schema description of DisableImplicitUnoWinAppSdkPackages, which that PR also edits, can mention the exception.

Tests

Given_UnoSdkRendererFeatures (Uno.UI.Tasks.Tests, 13 cases) evaluates the in-repo SDK with its own Directory.Build.targets and checks the PackageReference items:

  • the SkiaRenderer cases for the property in the project, in an inner build and in a Directory.Build.targets fail on master;
  • the Directory.Build.targets case also fails if the decision moves into Uno.Features.targets;
  • the Skia cases fail if the strip drops an explicit Skia too;
  • the single-targeted case fails with IsWinAppSdk back.

Uno.UI.Tasks.Tests: 117/117 pass, and 132/132 merged with #25567.

Runtime, packing a library with locally built SDKs: on master, the Windows group depends on Uno.WinUI.Graphics2DSK and SkiaSharp.Views.WinUI with the property in the project or in a Directory.Build.targets. With this change it has neither, and with Skia listed it has both.

PR Checklist ✅

The 'skia' feature is implied on every target but WinAppSDK, tested
through IsWinAppSdk. Uno.IsPlatform.props sets that property before the
project body, so a project that sets TargetFramework there, rather than
being an inner build of TargetFrameworks, got IsWinAppSdk only later,
from Uno.Common.WinAppSdk.targets. Uno.Features.targets is evaluated in
between, so such a Windows project still had 'skia' implied and got
SkiaSharp.Views.WinUI and Uno.WinUI.Graphics2DSK.

Test the target framework, as Uno.Common.targets does to import the
WinAppSDK targets.
DisableImplicitUnoWinAppSdkPackages keeps a library's Windows App SDK
build free of the base Uno packages, so that WinAppSDK-only consumers
don't get them and a strong-named Windows build keeps a fully
strong-named dependency chain. UnoFeatures packages are left in place on
purpose, but the legacy SkiaRenderer token is mapped to 'skia', so a
library that lists it for its Uno targets still got
Uno.WinUI.Graphics2DSK, SkiaSharp.Views.WinUI and, with Toolkit,
Uno.Toolkit.Skia.WinUI on Windows. The token chose a renderer, which
does not apply to WinAppSDK.

Record when only SkiaRenderer asks for Skia, and strip those packages
with the others in that mode. An explicit Skia keeps them, and heads
keep mapping SkiaRenderer to Skia on Windows. The strip is an item
condition, so the property still counts when set in a
Directory.Build.targets; deciding in Uno.Features.targets would not.
Evaluates the in-repo Uno.Sdk in a temporary directory with its own
Directory.Build.props and Directory.Build.targets, and checks the
PackageReference items. A Windows target that names no renderer gets no
Skia package, whether TargetFramework comes from an inner build or from
the project body. A WinAppSDK-only library that lists SkiaRenderer gets
none on Windows, whether it opts in from the body, from an inner build
or from a Directory.Build.targets, while one that lists Skia, a head, or
a library without the property gets them. Its Uno targets still map
SkiaRenderer to Skia.
Notes wherever the docs say SkiaRenderer maps to or counts as Skia (the
Skia feature, the Skia rendering page and the 7.0 migration note) that a
WinAppSDK-only library's Windows target is the exception, and explains
it in the WinAppSDK-only libraries section. Also corrects the
SKCanvasElement page, which said the package is referenced on every
target.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 08:27
@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation labels Oct 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The scoped changes match the issue requirements, preserve explicit opt-ins, and have targeted regression coverage with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #25570 by preventing legacy SkiaRenderer from adding Skia packages to WinAppSDK-only libraries, while preserving explicit Skia opt-ins and existing behavior elsewhere.

Changes:

  • Strips legacy-implied Skia packages from opted-out Windows libraries.
  • Corrects implicit Skia detection for single-targeted WinAppSDK projects.
  • Adds 13 regression cases and documents package-selection behavior.
File Description
src/​Uno.Sdk/​targets/​Uno.Implicit.Packages.ProjectSystem.targets Strips legacy-implied Skia packages from opted-out libraries.
src/​Uno.Sdk/​targets/​Uno.Features.targets Tracks legacy-only Skia requests and corrects Windows detection.
src/​SourceGenerators/​Uno.UI.Tasks.Tests/​Given_UnoSdkRendererFeatures.cs Tests package selection across features and property placements.
doc/​articles/​migrating-to-uno-7.md Documents the migration exception for Windows libraries.
doc/​articles/​features/​using-the-uno-sdk.md Explains explicit Skia opt-in behavior.
doc/​articles/​features/​using-skia-rendering.md Clarifies legacy renderer mapping.
doc/​articles/​controls/​SKCanvasElement.md Corrects automatic package-reference guidance.

Review effort: Balanced

@unodevops

Copy link
Copy Markdown
Contributor

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is closed, so it cannot be queued. Reopen it to get the box back.

@mikernet

Copy link
Copy Markdown
Contributor Author

Closing this as superseded by changes that landed on master since:

Together they keep Uno.WinUI.Graphics2DSK, SkiaSharp.Views.WinUI and Uno.Toolkit.Skia.WinUI out of a WinAppSDK-only library's Windows build, with the property in the project, in an inner build or in a Directory.Build.targets. That is what this PR set out to do. This PR's remaining test cases assert the earlier behavior that those PRs deliberately reversed, so there is nothing left here to merge.

@mikernet mikernet closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Uno.Sdk] SkiaRenderer adds Uno.WinUI.Graphics2DSK to WinAppSDK-only libraries

3 participants