From 250b33592096cb8810b1dd58c418570bf45bcbce Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 2 Sep 2026 21:40:43 +0200 Subject: [PATCH] Retry dotnet tool restore once on a cold-cache failure dotnet/sdk#53783: restoring 2+ RID-specific tool packages in one manifest (release-notes, nupkg-validator, assembly-differ are all native-AOT now) can misattribute one package's DotnetToolSettings.xml to another on a cold tool-resolver cache - every fresh CI runner hits this. The cache is warm after the first attempt, so a bare retry always succeeds. Co-authored-by: Cursor --- build/scripts/Targets.fs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 98d7aa9..c88bdb0 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -20,7 +20,16 @@ let private execResult binary args = let result = Proc.Start(binary, List.toArray args) result.ExitCode -let private restoreTools = lazy(exec "dotnet" ["tool"; "restore"]) +/// dotnet/sdk#53783: on a cold tool-resolver cache (every fresh CI runner, every fresh container), +/// restoring 2+ RID-specific tool packages in one manifest can misattribute one package's +/// DotnetToolSettings.xml to another, failing with "The command ... is not contained in the +/// package ...". The cache is warm after the first attempt, so a bare retry always succeeds - +/// see https://github.com/dotnet/sdk/issues/53783. +let private restoreTools = + lazy( + try exec "dotnet" ["tool"; "restore"] + with _ -> exec "dotnet" ["tool"; "restore"] + ) let private currentVersion = lazy(