You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Install the SDK from sdk.version when tools.dotnet is not specified - #17816
This lets repositories specify the SDK version only once, under sdk.version, and leverage tools like Dependabot to keep it up-to-date. Dependabot doesn't know about tools.dotnet as it's an Arcade-only concept.
Behavior
tools.dotnet specified: unchanged, tools.dotnet is installed (it wins over sdk.version).
No tools.dotnet, sdk.version specified: sdk.version is installed. Previously this was a hard error in bash and, on Windows, either an error (dotnet engine) or no SDK bootstrapping (tools.vs repos).
Neither specified: error (bash and dotnet engine), same as before. Windows tools.vs-only repos keep using VS MSBuild without bootstrapping an SDK.
On Windows, a tools.vs + sdk.version repo is now treated like today's tools.vs + tools.dotnet repos (e.g. roslyn, msbuild, wpf): VS MSBuild is used and the SDK is bootstrapped into .dotnet and prepended to PATH. None of the ~40 public Arcade repos I checked use tools.vs without tools.dotnet.
The tools section in global.json is now optional on Windows too (previously tools.ps1 threw when it was missing).
Changes
eng/common/tools.ps1: GetDotNetSdkVersion returns tools.dotnet, else sdk.version, else $null. GlobalJsonSpecifiesDotNetSdk (used by InitializeBuildTool and GetDefaultMSBuildEngine) is true when either is set. A missing tools section is defaulted to an empty object. The runtimes check uses Get-Member, so it no longer throws under strict mode for an empty tools object.
eng/common/tools.sh: InitializeDotNetCli reads the version via ReadDotNetSdkVersion (jq '.tools.dotnet // .sdk.version', plus a regex fallback without jq; the sdk.version regex skips over quoted strings so braces inside e.g. sdk.errorMessage don't break it).
LocateDotNet (Arcade SDK task) reads the version through an internal TryGetDotNetSdkVersion method (System.Text.Json) with the same precedence, instead of a "dotnet" regex.
Removed the unused CheckRequiredDotNetVersion task (and its UsingTask). It had no usages and would otherwise also have needed updating.
Documentation/ArcadeSdk.md: documented the fallback.
Other scripts (dotnet.*, darc-init.*, vmr-sync.*, post-build/*) go through InitializeDotNetCli and pick this up automatically.
Note: Maestro/darc only bumps the SDK (tools.dotnet and sdk.version) in repos that specify tools.dotnet. Repos that drop it rely on e.g. Dependabot for SDK updates. Arcade and the VMR must keep tools.dotnet since darc reads it from the source repo.
dotnet test artifacts\bin\Microsoft.DotNet.Arcade.Sdk.Tests\Debug\net12.0\Microsoft.DotNet.Arcade.Sdk.Tests.dll --filter "FullyQualifiedName~LocateDotNetTests|FullyQualifiedName~InstallDotNetCoreTests": passed (9/9, including 6 LocateDotNetTests cases).
Ran the scripts against synthetic repos with eight global.json shapes: tools.dotnet only; both; sdk.version only without a tools section; sdk.version + tools.vs; tools.vs only; neither; sdk.errorMessage containing {, } and escaped quotes before version; sdk.version + tools.runtimes. Each case checks version, default engine and runtimes detection:
PowerShell 7 and Windows PowerShell 5.1, each with and without an extra Set-StrictMode -Version 2.0 (tools.ps1 enables it itself): passed (32/32).
bash 5.2 (WSL, set -eu), with and without jq: passed (16/16).
End-to-end: InitializeBuildTool with only sdk.version and no tools section resolved an installed SDK via DOTNET_INSTALL_DIR (pwsh and Windows PowerShell): passed.
Allow repositories to set "tools": { "downloadSdkVersion": true } in global.json
so that eng/common/tools.ps1 and tools.sh install the SDK version specified in
"sdk.version" instead of "tools.dotnet". This lets repos specify the SDK version
once and use tools like Dependabot (which only understand "sdk.version") to keep
it up-to-date.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 92e5d4ad-1f02-4608-88b1-2420560b5813
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
SDK bootstrapping can fail on braces in quoted error messages, and LocateDotNet and CheckRequiredDotNetVersion still require the legacy dotnet key instead of honoring the documented sdk.version configuration.
Adds an opt-in tools.downloadSdkVersion setting so Arcade’s bootstrap scripts can install the SDK from sdk.version, avoiding duplicate version declarations and supporting Dependabot updates.
Changes:
Adds SDK-version selection and missing-version validation to Bash and PowerShell.
Updates PowerShell build-tool detection to recognize the new switch.
Documents the switch, its precedence, and an example configuration.
File
Description
eng/common/tools.sh
Adds SDK-version selection through jq or a regex fallback.
eng/common/tools.ps1
Adds version-selection helpers and updates build-tool detection.
Documentation/ArcadeSdk.md
Documents the opt-in setting and configuration example.
…sh fallback
- LocateDotNet and CheckRequiredDotNetVersion now read the SDK version through a
shared GlobalJson helper that honors tools.downloadSdkVersion (sdk.version)
and otherwise reads tools.dotnet.
- tools.sh: the no-jq fallback regex consumes quoted strings as a whole so braces
inside e.g. sdk.errorMessage don't break parsing.
- tools.ps1: only a JSON boolean true enables the switch, consistent with
tools.sh and the tasks.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 92e5d4ad-1f02-4608-88b1-2420560b5813
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The no-jq fallback can match comments or properties outside the root tools object, overriding an explicit false value and causing bootstrapping to select the wrong SDK version or fail.
Restrict the fallback check to tools.downloadSdkVersion
eng/common/tools.sh:142
Without jq, this regex enables the switch from comments or properties outside tools, even when tools.downloadSdkVersion is explicitly false. For example, // "downloadSdkVersion": true or "custom": { "downloadSdkVersion": true } makes bootstrapping use sdk.version instead of tools.dotnet, or fail if sdk.version is absent. Make the fallback ignore comments and check only the boolean property in the root tools object.
Re the no-jq fallback matching downloadSdkVersion outside of tools / in comments: comments aren't supported in global.json by the Arcade scripts (the jq and Windows PowerShell paths already fail on them), and matching the key elsewhere in the file is an accepted limitation of the simple regex fallback. Not changing this.
Also removed the unused CheckRequiredDotNetVersion task in 3b77c26, so only LocateDotNet needed updating for the switch.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Removing the public CheckRequiredDotNetVersion task and its registration risks breaking downstream consumers without following the documented breaking-change process.
The helper only has a single consumer now that CheckRequiredDotNetVersion is gone.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 92e5d4ad-1f02-4608-88b1-2420560b5813
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Removing a public MSBuild task can break consuming repositories, requiring human assessment of downstream compatibility and compliance with the breaking-change policy.
Drop the tools.downloadSdkVersion opt-in switch. Arcade now installs
'tools.dotnet' if specified, otherwise 'sdk.version'. In tools.ps1, the
'tools' section in global.json is now optional and the runtimes check
no longer throws under strict mode for an empty 'tools' object.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: e0dbec8f-3832-4bb7-a663-ed18780aec88
ViktorHofer
changed the title
Add tools.downloadSdkVersion switch to install the SDK from sdk.version
Install the SDK from sdk.version when tools.dotnet is not specified
Nov 18, 2026
@ViktorHofer backporting to release/11.0 failed, the patch most likely resulted in conflicts. Please backport manually!
git am output
$ git cherry-pick 9f5b80b49da9b9d6b044e3b107ad678f1c8d0e77Auto-merging Documentation/ArcadeSdk.mdAuto-merging eng/common/tools.ps1Auto-merging eng/common/tools.shCONFLICT (modify/delete): src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs deleted in 9f5b80b49 (Install the SDK from sdk.version when tools.dotnet is not specified (#17816)) and modified in HEAD. Version HEAD of src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs left in tree.Auto-merging src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.csCONFLICT (content): Merge conflict in src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.csAuto-merging src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.propsCONFLICT (content): Merge conflict in src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.propserror: could not apply 9f5b80b49... Install the SDK from sdk.version when tools.dotnet is not specified (#17816)hint: After resolving the conflicts, mark them withhint: "git add/rm <pathspec>", then runhint: "git cherry-pick --continue".hint: You can instead skip this commit with "git cherry-pick --skip".hint: To abort and get back to the state before "git cherry-pick",hint: run "git cherry-pick --abort".hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patchApplying: Add tools.downloadSdkVersion switch to install the SDK from sdk.versionApplying: Address PR feedback: honor downloadSdkVersion in SDK tasks, harden bash fallbackUsing index info to reconstruct a base tree...M eng/common/tools.ps1M eng/common/tools.shM src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.csM src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.csFalling back to patching base and 3-way merge...Auto-merging eng/common/tools.ps1Auto-merging eng/common/tools.shAuto-merging src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.csAuto-merging src/Microsoft.DotNet.Arcade.Sdk/src/LocateDotNet.csApplying: Remove unused CheckRequiredDotNetVersion taskUsing index info to reconstruct a base tree...M src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.csM src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.propsFalling back to patching base and 3-way merge...CONFLICT (modify/delete): src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs deleted in Remove unused CheckRequiredDotNetVersion task and modified in HEAD. Version HEAD of src/Microsoft.DotNet.Arcade.Sdk/src/CheckRequiredDotNetVersion.cs left in tree.Auto-merging src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.propsCONFLICT (content): Merge conflict in src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.propserror: Failed to merge in the changes.hint: Use 'git am --show-current-patch=diff' to see the failed patchhint: When you have resolved this problem, run "git am --continue".hint: If you prefer to skip this patch, run "git am --skip" instead.hint: To restore the original branch and stop patching, run "git am --abort".hint: Disable this message with "git config set advice.mergeConflict false"Patch failed at 0003 Remove unused CheckRequiredDotNetVersion taskError: The process '/usr/bin/git' failed with exit code 128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
global.jsondoesn't specifytools.dotnet, Arcade now installs/uses the SDK version specified insdk.version. No opt-in switch is needed.{ "sdk": { "version": "10.0.100", "rollForward": "latestFeature" } }This lets repositories specify the SDK version only once, under
sdk.version, and leverage tools like Dependabot to keep it up-to-date. Dependabot doesn't know abouttools.dotnetas it's an Arcade-only concept.Behavior
tools.dotnetspecified: unchanged,tools.dotnetis installed (it wins oversdk.version).tools.dotnet,sdk.versionspecified:sdk.versionis installed. Previously this was a hard error in bash and, on Windows, either an error (dotnet engine) or no SDK bootstrapping (tools.vsrepos).tools.vs-only repos keep using VS MSBuild without bootstrapping an SDK.tools.vs+sdk.versionrepo is now treated like today'stools.vs+tools.dotnetrepos (e.g. roslyn, msbuild, wpf): VS MSBuild is used and the SDK is bootstrapped into.dotnetand prepended to PATH. None of the ~40 public Arcade repos I checked usetools.vswithouttools.dotnet.toolssection inglobal.jsonis now optional on Windows too (previouslytools.ps1threw when it was missing).Changes
eng/common/tools.ps1:GetDotNetSdkVersionreturnstools.dotnet, elsesdk.version, else$null.GlobalJsonSpecifiesDotNetSdk(used byInitializeBuildToolandGetDefaultMSBuildEngine) is true when either is set. A missingtoolssection is defaulted to an empty object. Theruntimescheck usesGet-Member, so it no longer throws under strict mode for an emptytoolsobject.eng/common/tools.sh:InitializeDotNetClireads the version viaReadDotNetSdkVersion(jq '.tools.dotnet // .sdk.version', plus a regex fallback withoutjq; thesdk.versionregex skips over quoted strings so braces inside e.g.sdk.errorMessagedon't break it).LocateDotNet(Arcade SDK task) reads the version through an internalTryGetDotNetSdkVersionmethod (System.Text.Json) with the same precedence, instead of a"dotnet"regex.CheckRequiredDotNetVersiontask (and itsUsingTask). It had no usages and would otherwise also have needed updating.Documentation/ArcadeSdk.md: documented the fallback.Other scripts (
dotnet.*,darc-init.*,vmr-sync.*,post-build/*) go throughInitializeDotNetCliand pick this up automatically.Note: Maestro/darc only bumps the SDK (
tools.dotnetandsdk.version) in repos that specifytools.dotnet. Repos that drop it rely on e.g. Dependabot for SDK updates. Arcade and the VMR must keeptools.dotnetsince darc reads it from the source repo.Validation
.\eng\common\build.ps1 -restore -build -projects src\Microsoft.DotNet.Arcade.Sdk.Tests\Microsoft.DotNet.Arcade.Sdk.Tests.csproj: passed (0 warnings, 0 errors).dotnet test artifacts\bin\Microsoft.DotNet.Arcade.Sdk.Tests\Debug\net12.0\Microsoft.DotNet.Arcade.Sdk.Tests.dll --filter "FullyQualifiedName~LocateDotNetTests|FullyQualifiedName~InstallDotNetCoreTests": passed (9/9, including 6LocateDotNetTestscases).global.jsonshapes:tools.dotnetonly; both;sdk.versiononly without atoolssection;sdk.version+tools.vs;tools.vsonly; neither;sdk.errorMessagecontaining{,}and escaped quotes beforeversion;sdk.version+tools.runtimes. Each case checks version, default engine and runtimes detection:Set-StrictMode -Version 2.0(tools.ps1enables it itself): passed (32/32).set -eu), with and withoutjq: passed (16/16).InitializeBuildToolwith onlysdk.versionand notoolssection resolved an installed SDK viaDOTNET_INSTALL_DIR(pwsh and Windows PowerShell): passed.To double check: