From 1f5230f903f1983da1693efb1334b4df656581c2 Mon Sep 17 00:00:00 2001 From: XperiAndri Date: Sun, 11 Oct 2026 01:24:25 +0200 Subject: [PATCH] fix(build): restore the tools once per build instead of once per project `ToolRestore` runs in every project before its restore, and a solution restores its projects in parallel, so several projects can run `dotnet tool restore` at the same time and touch the same marker file. Whether they overlap depends on timing: with this solution they did not in local runs. Every project now delegates to one instance of `Directory.Build.targets`, which MSBuild builds once per build, so the tools are restored once and the projects that ask at the same time wait for that run. The Copilot setup no longer restores the tools on its own before restoring the solution. `Format` says why it runs Fantomas twice. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/copilot-setup-steps.yml | 5 ++--- Directory.Build.targets | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 6ae61ed..2c2e9ae 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -38,6 +38,5 @@ jobs: 10.x - name: Restore dependencies - run: | - dotnet tool restore - dotnet restore FSharp.Control.R3.slnx + # Restoring the solution restores the local tools first (see Directory.Build.targets) + run: dotnet restore FSharp.Control.R3.slnx diff --git a/Directory.Build.targets b/Directory.Build.targets index e69ea9e..8b9a078 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -11,8 +11,18 @@ See https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-director <_DotnetFantomasOutputFile>$(BaseIntermediateOutputPath)dotnet-fantomas-msbuild-$(NETCoreSdkVersion)-$(OS) - - + + + + + + @@ -51,6 +61,7 @@ See https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-director +