Skip to content

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

Merged
agneszitte merged 2 commits into
masterfrom
dev/agzi/sdk-windowssdkpackageversion-wins
Nov 10, 2026
Merged

agneszitte merged 2 commits into
masterfrom
dev/agzi/sdk-windowssdkpackageversion-wins

Conversation

@agneszitte

@agneszitte agneszitte commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #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.

Needs a backport to release/stable/7.0 (#26277), 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 12s —— View job


Review summary

Verdict: ship. No blocking issues.

Findings: 0 critical, 0 major, 0 minor.

The change is one extra condition on the WindowsSdkPackageMinimumRevision default in src/Uno.Sdk/targets/Uno.Common.WinAppSdk.targets. The default now applies only when the project has not set WindowsSdkPackageVersion. This avoids NETSDK1230, which the .NET SDK raises when both properties are set.

Cross-cutting notes

  • I only read the diff and grepped the SDK targets. I did not build it or run the validation matrix in the PR description.
  • The new condition depends on WindowsSdkPackageVersion being set before this PropertyGroup is evaluated. That holds for the cases the PR lists: project file, Directory.Build.props and environment variable. A value set later, such as inside a target, would not be seen. That is unlikely and not worth blocking on.
  • The change has no automated test. Targets changes like this are hard to cover in-repo. The manual validation table in the PR description is reasonable. If an SDK-level test harness exists, a case covering "explicit version set" would help prevent regressions.
  • The PR title follows Conventional Commits.
  • The backport to release/stable/7.0 noted in the description still needs to happen.

agneszitte added a commit that referenced this pull request Nov 10, 2026
With #26276 an explicit WindowsSdkPackageVersion wins over the Uno.Sdk default again, so
NETSDK1230 no longer happens on a public 7.0 build. What still breaks is a projection older
than .87 (the 6.0 guide's .57), which fails with CS1705: remove the property or raise it.

@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: this fixes the cases reported in #26174 (version set in the csproj, Directory.Build.props, an environment variable or -p:), and nothing that builds today changes behavior.

Two cases of the same bug remain, both confirmed with a real build on .NET SDK 10.0.402. Details and a tested fix are in the inline comment. It's a small move that could be folded into this PR, or into a follow-up if you prefer.

The same change applies to the backport #26277 (identical diff). Uno.Sdk.After.targets exists on release/stable/7.0 too, so it stays a cherry-pick.

Optional, non-blocking:

  • Regression coverage: build/test-scripts/run-netcore-mobile-template-tests.ps1 already builds Windows heads through Uno.Sdk. A copy of the net11.0-windows10.0.26100 row (line 238) with -p:WindowsSdkPackageVersion=10.0.26100.87 would fail with NETSDK1230 without the fix.
  • Diagnostics for old pins: a project pinned below .87 now fails with CS1705, and that error doesn't name WindowsSdkPackageVersion. #26273 documents it. A UNOB warning when the pinned revision is below 87 could be a later follow-up.

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 16s —— View job


Review summary

Verdict: ship. No blocking issues.

Findings: 0 critical, 0 major, 0 minor.

This update moves the WindowsSdkPackageMinimumRevision default into Uno.Sdk.After.targets, as carldebilly suggested. It applies only when IsWinAppSdk is true and none of WindowsSdkPackageMinimumRevision, WindowsSdkPackageVersion or UseWindowsSDKPreview=true is set.

  • Evaluation order: Sdk.targets imports Uno.Sdk.After.targets (line 40) after the .NET SDK targets (line 33). The default is therefore evaluated after Directory.Build.targets too. That covers the two cases the earlier approach missed: WindowsSdkPackageVersion set in Directory.Build.targets, and UseWindowsSDKPreview=true.
  • IsWinAppSdk: it is set in Uno.IsPlatform.props and Uno.Common.WinAppSdk.targets, both earlier than the new group. The condition sees its final value.
  • Regression coverage: the new row in run-netcore-mobile-template-tests.ps1 passes -p:WindowsSdkPackageVersion=10.0.26100.87 on the Windows head. It would fail with NETSDK1230 without the fix.

Notes

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

@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.

Thanks for the quick turnaround. The default now lives in Uno.Sdk.After.targets with the UseWindowsSDKPreview guard, and the template row covers the explicit-version case. LGTM.

agneszitte added a commit that referenced this pull request Nov 10, 2026
…indows SDK section

Matches #26276 after its review: the Uno.Sdk default also steps aside for
UseWindowsSDKPreview, and a WindowsSdkPackageVersion set in a Directory.Build.targets
file is respected too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@unodevops

Copy link
Copy Markdown
Contributor

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

agneszitte added a commit that referenced this pull request Nov 10, 2026
…kageversion-wins-stable-7.0

fix(sdk): Respect a Windows SDK version or preview the project picks (backport #26276)
@agneszitte
agneszitte merged commit de25b12 into master Nov 10, 2026
69 of 79 checks passed
@agneszitte
agneszitte deleted the dev/agzi/sdk-windowssdkpackageversion-wins branch November 10, 2026 03:59
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.

Uno.Sdk: setting WindowsSdkPackageVersion fails with NETSDK1230 since the default WindowsSdkPackageMinimumRevision was added

3 participants