Skip to content

build: NuGet lock files and locked restores, so the Windows App SDK cannot float silently (#1085) - #1087

Merged
deblasis merged 2 commits into
windowsfrom
claude/nuget-lock-files
Sep 11, 2026
Merged

deblasis merged 2 commits into
windowsfrom
claude/nuget-lock-files

Conversation

@deblasis

@deblasis deblasis commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

Depends on #1084 (branched from its branch; it carries the one-line
NotificationHost.xaml fix a fresh restore needs under WinUI 2.2.1). Rebase
onto windows follows once that lands.

Why WinUI resolves to 2.2.1 under the 2.2.0 pin

The Microsoft.WindowsAppSDK 2.2.0 metapackage's own nuspec depends on
Microsoft.WindowsAppSDK.WinUI with the open range >= 2.2.1. There is no
WinUI 2.2.0 on nuget.org at all: the version index jumps from 2.1.0 straight
to 2.2.1, and registration shows both published 2026-06-09 as part of the
2.2.0 train. NuGet's lowest-applicable rule lands on 2.2.1 and will move to
whatever the next stable WinUI >= 2.2.1 is (2.2.2-experimental is already on
the feed), because the range is open. Eight of the metapackage's nine
component dependencies are floored the same way (AI >= 2.2.3, ML >= 2.1.70,
Base, Foundation, DWrite, Widgets, InteractiveExperiences); only Runtime is
exact-pinned [2.2.0]. The float is not theoretical: between two
consecutive days' restores of the same tree, Microsoft.DotNet.ILCompiler
(and ILLink.Tasks, win-x64 runtime) moved 10.0.11 to 10.0.12.

The choice: lock what resolves today (WinUI 2.2.1)

Pinning WinUI back to 2.2.0 is not an option that exists: that version was
never published. WinUI 2.2.1 has been the resolution since the 2.2.0 pin
landed (it is what every restore this machine made produced), and #1084's
XAML fix already accommodates its compiler. So the locks freeze exactly
today's resolution, with content hashes, and any future move becomes a
deliberate lock update that review sees.

What this changes

  • RestorePackagesWithLockFile in windows/Directory.Build.props and a new
    dist/windows/Directory.Build.props (the IconGen/SplashGen quartet
    restores as part of Ghostty.sln); 13 committed packages.lock.json
    files, one beside every csproj that restores, including the three
    non-solution helper projects (RasterizeIcons, BackdropStage,
    WindowCapture). Locked mode is passed per invocation rather than set in
    props, because the release tiers patch package references onto this
    tree and must keep restoring until their per-tier lock files exist (pin
    bump PR).
  • build-win, build-win-release, test-win and the windows-tests
    workflow restore with RestoreLockedMode=true: a PackageReference change
    without a regenerated lock fails the restore with NU1004 naming the delta.
  • Lock drift gate, first thing in test-win and in CI: an unlocked
    dotnet restore --force-evaluate regenerates every lock the way a fresh
    machine would, and the leg refuses to continue if the result differs from
    HEAD by content. Two hardening details are baked in, both found while
    verifying: --force-evaluate is required because an incremental restore
    on a warm tree is a no-op and never re-resolves; and the comparison is a
    git diff content check rather than git status, because NuGet rewrites
    lock files with CRLF while the repo stores them LF and status flags that
    EOL-only rewrite as modified on every fresh checkout. Untracked lock
    files fail the gate separately. Verified RED on a committed lock that
    says WinUI 2.2.0 (the restore rewrites it to 2.2.1, the gate stops the
    leg with the content hunk printed) and on a csproj edit without a
    regenerated lock (NU1004 naming the delta), then GREEN on the clean tree.

Fixes #1085

deblasis added a commit that referenced this pull request Sep 10, 2026
… the helper locks (#1087 review)

Three Lows from the review round, all fixed:

- CI drift gate step: a failed restore used to fall through to the
  diff check, which then finds no drift and exits 0, a vacuous green.
  pwsh does not stop on native-command failure, so the step now exits
  with the restore's own code right after each restore line.
- release_gate_check.ps1 restored and tested Release UNLOCKED, so the
  release-gate leg compiled against the live feed. Its dotnet build and
  dotnet test now pass RestoreLockedMode like the rest of the ladder;
  the msbuild -getProperty probe only evaluates properties and never
  restores, so it needs nothing.
- The three non-solution helper projects (RasterizeIcons, BackdropStage,
  WindowCapture) had committed locks that nothing regenerated or locked.
  The test-win gate force-evaluates them alongside the solution, gives
  them a locked restore (NU1004 on a stale helper lock), and the
  remediation text now names the actual regeneration path.
The WindowsAppSDK 2.2.0 metapackage floors eight of its nine component
dependencies at open ranges (WinUI >= 2.2.1; no WinUI 2.2.0 exists on
nuget.org, the 2.2.0 train shipped WinUI as 2.2.1), so a fresh restore
resolves whatever the feed serves that day, and the same commit can
compile against different bits: Microsoft.DotNet.ILCompiler moved
10.0.11 -> 10.0.12 between two consecutive days' restores.

Every project that restores under windows/ and dist/windows/ now writes
a committed packages.lock.json. build-win, build-win-release, test-win
and the windows-tests workflow restore in locked mode, so the build
compiles against exactly what the locks resolve. test-win and CI also
run an unlocked restore first and refuse if it would change any
committed lock, so both drift shapes fail the ladder: a fresh-machine
float, and a PackageReference edit without a regenerated lock.
… the helper locks (#1087 review)

Three Lows from the review round, all fixed:

- CI drift gate step: a failed restore used to fall through to the
  diff check, which then finds no drift and exits 0, a vacuous green.
  pwsh does not stop on native-command failure, so the step now exits
  with the restore's own code right after each restore line.
- release_gate_check.ps1 restored and tested Release UNLOCKED, so the
  release-gate leg compiled against the live feed. Its dotnet build and
  dotnet test now pass RestoreLockedMode like the rest of the ladder;
  the msbuild -getProperty probe only evaluates properties and never
  restores, so it needs nothing.
- The three non-solution helper projects (RasterizeIcons, BackdropStage,
  WindowCapture) had committed locks that nothing regenerated or locked.
  The test-win gate force-evaluates them alongside the solution, gives
  them a locked restore (NU1004 on a stale helper lock), and the
  remediation text now names the actual regeneration path.
@deblasis
deblasis force-pushed the claude/nuget-lock-files branch from 65ac0ed to 0e5c377 Compare September 11, 2026 06:29
@deblasis
deblasis merged commit 626038d into windows Sep 11, 2026
113 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builds are not reproducible: the transitive Windows App SDK floats (WinUI 2.2.1 under a 2.2.0 pin) and there are no NuGet lock files

1 participant