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(