Skip to content

fix(build): restore the tools once per build instead of once per project - #45

Open
xperiandri wants to merge 1 commit into
mainfrom
fix/tool-restore-once
Open

xperiandri wants to merge 1 commit into
mainfrom
fix/tool-restore-once

Conversation

@xperiandri

Copy link
Copy Markdown
Collaborator

Proposed Changes

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. 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 Restore dependencies step of the Copilot setup no longer runs dotnet tool restore on its own before restoring the solution. Format gets a comment that says why it runs Fantomas twice.

Types of changes

What types of changes does your code introduce to FSharp.Control.R3?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • Build and tests pass locally – build.cmd with CI=true and ENABLE_COVERAGE=true; a solution restore without the marker file restores the tools once, and a repeated one does not restore them
  • I have added tests that prove my fix is effective or that my feature works (if appropriate) – only the build infrastructure changes
  • I have added necessary documentation (if appropriate) – the reasons are in the comments of Directory.Build.targets

Further comments

No failure was observed in this repository: in five local solution restores without the marker file the tools were restored once each time, before and after the change. Whether the projects overlap depends on timing, so the change removes the possibility rather than a reproduced failure.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 10, 2026 23:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The MSBuild delegation correctly serializes identical restoration requests without changing normal restore behavior.

0 open findings

What changed in this PR

This PR prevents concurrent local-tool restores by coordinating them through a single MSBuild project instance.

Changes:

  • Delegates tool restoration to the incremental ToolRestoreOnce target.
  • Removes redundant tool restoration from Copilot setup.
  • Documents the intentional second Fantomas pass.
File Description
Directory.Build.targets Coordinates tool restoration and documents formatting behavior.
.github/​workflows/​copilot-setup-steps.yml Relies on solution restore to restore local tools.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

`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 <noreply@anthropic.com>
@xperiandri
xperiandri force-pushed the fix/tool-restore-once branch from 31979d2 to 1f5230f Compare October 11, 2026 15:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants