Skip to content

Repository files navigation

dotnet-affected

Build and test only the projects your changes actually affect.

NuGet NuGet Downloads Build MIT

📖 Documentation


A .NET tool that works out which MSBuild projects a set of changes affects, so large repositories and monorepos can build and test a fraction of themselves instead of all of it.

It compares your working tree against a baseline commit, maps the changed files to the projects that reference them, and walks the MSBuild project graph to find everything that depends on them.

Install

dotnet new tool-manifest
dotnet tool install dotnet-affected

Use

$ dotnet affected --from origin/main --uncommitted none
WRITE: /repo/affected.proj

affected.proj is an MSBuild Traversal project, so it behaves like a solution:

dotnet build affected.proj
dotnet test affected.proj

When nothing changed, no file is written and the tool exits 166 — check for it and skip the rest of the pipeline.

Documentation

Getting started Install, first run, how it works
Guides Discovery, output formats, exclusions, NuGet changes
CLI reference Every option and exit code
MSBuild SDK Run it from MSBuild, without the CLI
GitHub Action Run it in GitHub Actions
Upgrading to v7 What changed, and what to update

Features

  • Detects which projects changed, from any file they reference — not just source files.
  • Detects NuGet package changes when using Central Package Management.
  • Picks up Directory.Build.props/.targets and other imported files.
  • Outputs a Traversal project, a Solution Filter, plain text or JSON.
  • Supports .csproj, .fsproj and .vbproj, SDK and non-SDK style.

Contributing

Issues and pull requests are welcome. See Building the project to get set up.

License

MIT

About

Build and test only the projects your changes actually affect

Topics

Resources

Stars

404 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages