基于 Git 的增量构建和测试平台,适用于 .NET 和 .NET Core。
Incrementalist is a .NET tool that leverages libgit2sharp and Roslyn to compute incremental build steps for large .NET solutions. It helps optimize your CI/CD pipeline by building and testing only the projects affected by your changes.
Incrementalist is particularly valuable for:
Incrementalist is available in two forms:
dotnet tool for command-line use (
recommended)Install the command-line tool globally:
dotnet tool install --global Incrementalist.CmdOr install locally in your project:
# From your repository root
dotnet new tool-manifest # if you haven't already created a .config/dotnet-tools.json
dotnet tool install Incrementalist.CmdWhen installed globally, run commands directly using the incrementalist command with one of the available verbs:
# Get list of affected projects
incrementalist run --dry -b dev -f ./affected-projects.txt
# List affected folders
incrementalist list-affected-folders -b dev -f ./affected-folders.txt
# Run tests for affected projects
incrementalist run -b dev -- test -c Release
# Run tests for affected projects those matching a glob
incrementalist run -b dev --target-glob "src/*.Tests.csproj" -- test -c ReleaseWhen using Incrementalist as a local tool, you need to use dotnet tool run with an additional -- before the
Incrementalist commands:
…![NOTE] Don't call
dotnet tool run incrementalist- this runs into some very annoying parse issues: https://github.com/petabridge/Incrementalist/issues/378 . Just calldotnet incrementalistinstead.
Incrementalist supports JSON configuration files to store commonly used settings. This eliminates the need to specify the same command-line arguments repeatedly.
# Use default configuration file (.incrementalist/incrementalist.json)
incrementalist run -- build
# Specify a custom configuration file
incrementalist -c my-config.json run -- build
# Create configuration file with current settings
incrementalist create-config -b dev --verbose --parallelCreate a configuration file in your repository:
{
"gitBranch": "dev",
"verbose": true,
"runInParallel": true
}Command-line arguments take precedence over configuration file settings. See Configuration Documentation for complete details.
…Incrementalist can generate two types of output files using -f, --file:
Project Lists (with the run verb):
D:\src\Project1\Project1.csproj,D:\src\Project2\Project2.csprojFolder Lists (with the list-affected-folders verb):
D:\src\Project1,D:\src\Project2\SubFolderThese files can be used in build scripts, CI/CD pipelines, or other automation tools.
Incrementalist now uses a verb-based command structure. Common options are available across all verbs, with some verb-specific options.
…create-configCreates a new configuration file with current options.
incrementalist create-config [options]list-affected-foldersList affected folders instead of .NET projects.
incrementalist list-affected-folders [options]runRun a command against affected projects. Use the --dry option to test without executing.
incrementalist run [options] -- [dotnet command and arguments]Additional options for run:
--dry Optional. (Default: false) Performs a dry run without
executing any commands. Useful for testing.run-processRun a custom process against affected projects. Currently a discoverable alias for run that only supports dotnet commands.
incrementalist run-process [options] -- [process arguments]Additional options for run-process:
--process Required. The name or path of the process to start (e.g. 'dotnet', '/bin/bash', 'mytool').
Currently only 'dotnet' is supported.
--dry Optional. (Default: false) Performs a dry run without
executing any commands. Useful for testing.Execute dotnet CLI commands against affected projects using the run verb:
…After Incrementalist determines the initial set of affected projects based on Git changes and project dependencies, you can further refine this list using glob patterns.
--target-glob "": Only includes projects whose paths match the specified glob pattern(s). If multiple
patterns are provided, a project matching any of them will be included. This filter is applied first.--skip-glob "": Excludes projects whose paths match the specified glob pattern(s) from the list
remaining after any --target-glob filters have been applied. If multiple patterns are provided, a project matching
any of them will be excluded.Both options can be specified multiple times on the command line.
Example: Find all affected projects, but only run the build command on non-test projects within the src directory.
incrementalist run -b dev --target-glob "src/**/*.csproj" --skip-glob "**/*.Tests.csproj" -- build -c Release --nologoLicensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Copyright 2015-2025 Petabridge
暂无开放 Issues,或尚未同步最近议题。