From 69196a9c054120619d2e6a79e6850ec58ad5c957 Mon Sep 17 00:00:00 2001 From: Ivan Vydrin Date: Fri, 14 Aug 2026 09:00:32 +0300 Subject: [PATCH] Build on a named SDK, and keep the .NET 8 runtime for the net8.0 tests This repository commits packages.lock.json and restores with --locked-mode, but `setup-dotnet` took `10.0.x` -- whatever the runner had that day. Those two settings disagree: a lock file is a claim about what restore resolves, and the SDK is one of the inputs that decides it. LakeWright.NET went red this week on exactly that, when its runner crossed a feature band and `Microsoft.AspNetCore.App.Internal.Assets` moved with it. This repository is not exposed to that package today -- its Web samples target net8.0, where the Web SDK does not add it -- so this is fixing the class while it is cheap rather than after an instance. The `8.0.x` line stays. It is not there to choose the SDK; it is there so the net8.0 half of the test matrix has a runtime to run on, and pinning the build SDK does not provide that. So each job now installs 8.0.x *and* the SDK named in global.json. Verified on a local 10.0.303: restore --locked-mode and build -c Release both exit 0 across net8.0 and net10.0. --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/refresh-lock-files.yml | 2 +- global.json | 7 +++++++ 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 global.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f608c24..0673f78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: with: dotnet-version: | 8.0.x - 10.0.x + global-json-file: global.json # Named, so the failure can say what to do about it. NU1004 on a Dependabot branch means # the lock files were not regenerated, which is a chore rather than a defect -- and the @@ -63,7 +63,7 @@ jobs: with: dotnet-version: | 8.0.x - 10.0.x + global-json-file: global.json - name: Restore run: dotnet restore --locked-mode diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d83732f..4aed047 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: with: dotnet-version: | 8.0.x - 10.0.x + global-json-file: global.json - name: Resolve version id: version diff --git a/.github/workflows/refresh-lock-files.yml b/.github/workflows/refresh-lock-files.yml index 0890d0f..3e00444 100644 --- a/.github/workflows/refresh-lock-files.yml +++ b/.github/workflows/refresh-lock-files.yml @@ -51,7 +51,7 @@ jobs: with: dotnet-version: | 8.0.x - 10.0.x + global-json-file: global.json # --force-evaluate is the whole point: it re-resolves rather than asserting the lock is right. - run: dotnet restore --force-evaluate diff --git a/global.json b/global.json new file mode 100644 index 0000000..c396020 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "10.0.303", + "rollForward": "latestPatch", + "allowPrerelease": false + } +}