Repository navigation
Conversation
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.
There was a problem hiding this comment.
🟢 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
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25571/docs/index.html |
|
This pull request is closed, so it cannot be queued. Reopen it to get the box back. |
|
Closing this as superseded by changes that landed on master since:
Together they keep |
GitHub Issue: closes #25570
PR Type:
🐞 Bugfix
What changed? 🚀
DisableImplicitUnoWinAppSdkPackageskeeps a library's Windows App SDK build free of the base Uno packages.UnoFeaturespackages are left in place on purpose, but the legacySkiaRenderertoken is mapped toskia. A library that lists it for its Uno targets therefore still gotUno.WinUI.Graphics2DSK,SkiaSharp.Views.WinUIand, withToolkit,Uno.Toolkit.Skia.WinUIon Windows. That has two effects:Removing the token works on 7.0, where
Skiais implied on Uno Platform targets, but the migration guide says it can stay and the library templates add it.Changes:
SkiaRendereradds no Skia package on Windows.Uno.Features.targetsrecords 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 aDirectory.Build.targets. An explicitSkiakeeps them, and the library's Uno targets still mapSkiaRenderertoSkia. Heads, and libraries without the property, are unchanged, as feat(drawing)!: Factory seams, Skottie in the Skia backend, Svg/Lottie docs #25117 intends.skiais implied on a single-targeted WinAppSDK project. The check usedIsWinAppSdk, whichUno.IsPlatform.propssets before the project body, so it was false whenTargetFrameworkcame from the body.SkiaRenderermaps toSkianow notes the exception, including the 7.0 migration note. TheSKCanvasElementpage no longer says the package is referenced on every target.Behavior change: on 6.7 and 6.8,
SkiaRendereraddsUno.WinUI.Graphics2DSKon Windows. A WinAppSDK-only library (6.7.18+) that compilesSKCanvasElement,SKXamlCanvasor the Toolkit Skia controls on Windows throughSkiaRendererlistsSkia.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 ownDirectory.Build.targetsand checks thePackageReferenceitems:SkiaRenderercases for the property in the project, in an inner build and in aDirectory.Build.targetsfail on master;Directory.Build.targetscase also fails if the decision moves intoUno.Features.targets;Skiacases fail if the strip drops an explicitSkiatoo;IsWinAppSdkback.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.Graphics2DSKandSkiaSharp.Views.WinUIwith the property in the project or in aDirectory.Build.targets. With this change it has neither, and withSkialisted it has both.PR Checklist ✅
Screenshots Compare Test Runresults.