From 158e839068c30c48e3bc4d801235561e9e917fe7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 16:31:32 +0000 Subject: [PATCH 1/2] Initial plan From 32c419265b83b85b7a4259232e5095eb2509b4e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Jul 2026 16:34:08 +0000 Subject: [PATCH 2/2] Add SDK pinning recommendation to package lock files docs --- docs/core/install/upgrade.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/core/install/upgrade.md b/docs/core/install/upgrade.md index 35675d39ad5ab..5d18d7d761ff8 100644 --- a/docs/core/install/upgrade.md +++ b/docs/core/install/upgrade.md @@ -1,7 +1,7 @@ --- title: Upgrade to a new .NET version description: Learn how to upgrade an app to a new .NET version. Upgrade .NET when the current version goes out of support or when you want to use new features of .NET. Control versions of SDK, analyzers, and packages for predictable builds. -ms.date: 04/23/2026 +ms.date: 07/21/2026 ai-usage: ai-assisted --- @@ -141,6 +141,22 @@ To ensure builds fail if the lock file is out of date: After enabling lock files, run `dotnet restore` to generate the *packages.lock.json* file. Commit this file to source control. +> [!IMPORTANT] +> When you use package lock files, also pin the SDK version in a *global.json* file with `rollForward` set to `disable`. This keeps the SDK version and dependency graph in lockstep, preventing the lock file from changing unexpectedly when the SDK updates. + +Create a *global.json* file at the solution root with the exact SDK version and no roll-forward: + +```json +{ + "sdk": { + "version": "9.0.100", + "rollForward": "disable" + } +} +``` + +For more information, see [Control SDK version with global.json](#control-sdk-version-with-globaljson). For related tracking issues, see and . + #### Central package management Central package management (CPM) allows you to manage package versions in a single location for all projects in a solution. This approach simplifies version management and ensures consistency across projects.