Skip to content

fix(sdk): Respect a Windows SDK version or preview the project picks (backport #26276) - #26277

Merged
agneszitte merged 2 commits into
release/stable/7.0from
dev/agzi/sdk-windowssdkpackageversion-wins-stable-7.0
Nov 10, 2026
Merged

agneszitte merged 2 commits into
release/stable/7.0from
dev/agzi/sdk-windowssdkpackageversion-wins-stable-7.0

Conversation

@agneszitte

@agneszitte agneszitte commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: related to #26174

PR Type:

🐞 Bugfix

What changed? 🚀

Since #25836, the Uno.Sdk sets WindowsSdkPackageMinimumRevision to 87 on Windows targets, even when the project already picks a Windows SDK projection. The .NET SDK rejects a minimum revision next to WindowsSdkPackageVersion or UseWindowsSDKPreview, so those projects failed with NETSDK1230. That includes apps that followed the 6.0 migration guide, and Uno.Themes, Uno.Toolkit, Uno.Extensions and Uno.UI.RuntimeTests.Engine while moving to 7.0.29.

  • The default moves to Uno.Sdk.After.targets, after the .NET SDK and Directory.Build.targets, so a choice made anywhere in the project is seen. It was in Uno.Common.WinAppSdk.targets, which runs before Directory.Build.targets.
  • The default applies only when the project picked nothing: no WindowsSdkPackageVersion, no UseWindowsSDKPreview, no own WindowsSdkPackageMinimumRevision. Projects that set nothing still get the .87 projection.
  • Template tests: run-netcore-mobile-template-tests.ps1 also builds the 5.6 template's Windows head with -p:WindowsSdkPackageVersion=10.0.26100.87, which fails with NETSDK1230 without this change.

The move to Uno.Sdk.After.targets and the UseWindowsSDKPreview case come from Carl's review.

Validation: a net10.0-windows10.0.19041.0 library that imports Uno.Common.WinAppSdk.targets, Microsoft.NET.Sdk and Uno.Sdk.After.targets in the Uno.Sdk order, built with dotnet build (.NET SDK 10.0):

Case Before After
nothing set builds, minimum revision 87 builds, minimum revision 87
WindowsSdkPackageVersion in the project NETSDK1230 builds, the project's version is used
WindowsSdkPackageVersion as -p: or environment variable NETSDK1230 builds
WindowsSdkPackageVersion in Directory.Build.targets NETSDK1230 builds
UseWindowsSDKPreview=true NETSDK1230 no NETSDK1230 (then needs a preview Windows SDK package)
the project's own WindowsSdkPackageMinimumRevision kept kept

End to end: a library with Sdk="Uno.Sdk.Private" (Windows and desktop targets, Uno 7.0.29), built with the published Uno.Sdk.Private 7.0.29 and with a package packed from this branch:

Case (Windows target) 7.0.29 This branch
nothing set builds builds
WindowsSdkPackageVersion in the project NETSDK1230 builds
WindowsSdkPackageVersion in Directory.Build.targets NETSDK1230 builds
WindowsSdkPackageVersion as environment variable NETSDK1230 builds
UseWindowsSDKPreview=true NETSDK1230 no NETSDK1230 (then no preview Microsoft.Windows.SDK.NET.Ref to restore, expected)
desktop target builds, no minimum revision builds, no minimum revision

The local package is 7.0.999-local, so the UnoSdkVersionCheck target was turned off in the test app, as Uno.Build.targets suggests for dev testing.

A project that pins a projection older than .87 (the 6.0 guide's .57) still fails with CS1705, because Uno's Windows assemblies need WinRT.Runtime 2.3. The migration guide covers it (#26273). A UNOB warning naming the property could be a later follow-up.

Backport of #26276 to release/stable/7.0, so the first public 7.0 Uno.Sdk carries it.

PR Checklist ✅

🤖 Generated with Claude Code

Since #25836 the Uno.Sdk sets WindowsSdkPackageMinimumRevision to 87 on Windows
targets, even when the project already picked WindowsSdkPackageVersion. The .NET SDK
rejects both together, so every such project failed with NETSDK1230. The default now
applies only when the project picked no version.
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 10s —— View job


Review of #26277 (backport of #26276)

Verdict: ship. No inline findings (0 issues).

The change guards the default WindowsSdkPackageMinimumRevision=87 with '$(WindowsSdkPackageVersion)' == ''. A project that sets WindowsSdkPackageVersion itself no longer also gets the minimum revision, which avoids NETSDK1230. I only read the diff. I did not build it or run a restore with an explicit version.

  • Evaluation order: the property is read inside a .targets file, which is imported after the project body. A project-level WindowsSdkPackageVersion is therefore already defined when the condition is evaluated. A value passed on the command line (-p:) is also visible. The guard does not catch a version that another targets file or a Directory.Build.targets sets later.
  • Backport scope: the change is limited to one SDK targets file and has no API or behavior surface beyond the opt-out. It is low risk for release/stable/7.0.
  • Process: the PR description is empty. The repo template asks for a GitHub Issue: line, so it would help to add one, for example a reference to Uno.Sdk: setting WindowsSdkPackageVersion fails with NETSDK1230 since the default WindowsSdkPackageMinimumRevision was added #26174 or the original PR. The title and commit follow Conventional Commits.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@carldebilly carldebilly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving the backport. The same follow-up applies here as on the main PR: two NETSDK1230 cases remain (Directory.Build.targets, UseWindowsSDKPreview). See #26276 (review) for details and a tested fix. Uno.Sdk.After.targets exists on release/stable/7.0, so the change cherry-picks as is.

The default WindowsSdkPackageMinimumRevision moves to Uno.Sdk.After.targets, after the
.NET SDK and Directory.Build.targets, so a WindowsSdkPackageVersion set there is seen too,
and it's skipped with UseWindowsSDKPreview, which the .NET SDK also rejects next to a
minimum revision (NETSDK1230). The template tests build a Windows head with an explicit
WindowsSdkPackageVersion. From Carl's review.

Co-authored-by: Carl de Billy <[email protected]>
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 19s —— View job


Review of #26277 (backport of #26276)

Verdict: ship. There are no inline findings (0 blocker, 0 major, 0 minor).

I read the current diff, which now includes the follow-up. I did not build it or run the template tests.

  • Placement: Uno.Sdk.After.targets is imported last in Sdk/Sdk.targets:40, after Microsoft.NET.Sdk and the project body. The guard therefore sees a WindowsSdkPackageVersion set in the project, a Directory.Build.props or Directory.Build.targets, an environment variable or -p:. This covers the two NETSDK1230 cases carldebilly flagged: Directory.Build.targets and UseWindowsSDKPreview.
  • Removed default: the old default in Uno.Common.WinAppSdk.targets is removed, so the minimum is set in one place only.
  • Test coverage: run-netcore-mobile-template-tests.ps1 gains a build that passes -p:WindowsSdkPackageVersion=10.0.26100.87. This guards the regression in CI.
  • Remaining limit: a project that pins a projection older than .87 still gets CS1705. The PR description says the migration guide (docs: Remove or update WindowsSdkPackageVersion when migrating to Uno 7 #26273) covers this.
  • Process: the PR template asks for runtime tests or a manual sample. For an SDK targets change, the template-test entry is a reasonable substitute.

@agneszitte agneszitte changed the title fix(sdk): Let an explicit WindowsSdkPackageVersion win over the default (backport #26276) fix(sdk): Respect a Windows SDK version or preview the project picks (backport #26276) Nov 10, 2026
@agneszitte

Copy link
Copy Markdown
Member Author

Same follow-up folded in here (b672ec8), see #26276 (comment). Same files and tables as #26276.

@carldebilly carldebilly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Backport matches #26276 line for line. LGTM.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@agneszitte
agneszitte merged commit 78c746d into release/stable/7.0 Nov 10, 2026
67 of 75 checks passed
@agneszitte
agneszitte deleted the dev/agzi/sdk-windowssdkpackageversion-wins-stable-7.0 branch November 10, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants