Tools

Speed up CI builds with Meziantou.DeltaBuild

Gérald Barré (Meziantou's blog) Gérald Barré
Tools

Meziantou.DeltaBuild, a new global .NET tool, reads git diffs together with the MSBuild dependency graph and emits a reduced solution or traversal project containing only the projects a change touches, so monorepo CI pipelines can build and test less.

Key points

  • Install it once with `dotnet tool install --global Meziantou.DeltaBuild` and run `generate` against a .sln, .slnx or .proj file.
  • Projects count as affected when any owned file changes, then every transitive dependent is added by walking the graph upwards.
  • On GitHub Actions pull_request events it reads GITHUB_BASE_REF for the merge base, so no --base-commit is needed.
  • `--working-tree` includes staged, unstaged and untracked files, letting you preview the delta locally before committing.
  • `--shard` and `--total-shards` split affected test projects across agents; `--shard-separate` pins slow projects to distinct shards.
  • `--full-rebuild-trigger` takes globs; `global.json`, `nuget.config` and `.editorconfig` are hierarchical triggers that only rebuild their subtree.

Real-world use

  • A monorepo where a pull request touching one shared library would otherwise rebuild and retest dozens of unrelated services.
  • A CI matrix that spreads affected test projects across several agents to keep the wall-clock time of large test suites down.
  • A developer comparing uncommitted work against origin/main to know which projects must be built before pushing.
  • Repository-wide edits such as workflow files that must force a full rebuild through a glob trigger.

This summary was generated by the agent from the original post on Gérald Barré (Meziantou's blog). The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message