incremental-build

Diagnose and fix MSBuild targets that rebuild unnecessarily on subsequent builds.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill incremental-build-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: incremental-build
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-msbuild/skills/incremental-build
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill incremental-build-patrick-rex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Subsequent builds that should be no-ops instead re-execute targets, wasting time. This Skill helps you find why MSBuild targets run instead of being skipped and how to make custom targets properly incremental. ## Core Features & Use Cases - Root-Cause Diagnosis: Covers the 8 most common causes of broken incremental builds, including missing Inputs/Outputs, volatile output paths, unregistered FileWrites, and Visual Studio Fast Up-to-Date Check issues. - Binlog-Based Analysis: Guides you through capturing two binary logs and using the binlog MCP server or text-log replay to find 'Building target completely' versus 'Skipping target' messages and the exact input file that triggered a rebuild. - Fix Patterns: Provides complete XML examples for writing incremental custom targets with stable paths, FileWrites registration, and correct use of Returns versus Outputs. - Use Case: Your build takes minutes even when nothing changed. Capture first and second binlogs, search for 'is newer than output' messages, identify the offending target, and add proper Inputs/Outputs to restore fast no-op builds. ## Quick Start Ask the assistant to diagnose why my .NET project rebuilds everything on the second build even though nothing changed, using binlog analysis.

Frequently Asked Questions about incremental-build

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find out why MSBuild rebuilds a target every time?

Build twice with binary logs using dotnet build /bl:first.binlog and /bl:second.binlog, then search the second log for 'Building target completely' versus 'Skipping target' messages. Search for 'is newer than output' to find the exact input file that triggered the rebuild.

How do I make a custom MSBuild target incremental?

Add both Inputs and Outputs attributes to the target so MSBuild compares file timestamps and skips it when outputs are newer. Use stable paths like $(IntermediateOutputPath), register generated files in the FileWrites item group, and avoid timestamps or GUIDs in output paths.

Why does my project rebuild in Visual Studio but not on the command line?

Visual Studio uses its own Fast Up-to-Date Check that is separate from MSBuild's Inputs/Outputs mechanism and can be wrong with custom targets or non-standard item types. Set DisableFastUpToDateCheck to true or enable verbose up-to-date check logging to see which file FUTDC considers out of date.

What is the FileWrites item group in MSBuild used for?

FileWrites tracks files generated during the build so dotnet clean can remove them. Files created by custom targets but not registered accumulate across builds, are never cleaned, and can confuse incremental up-to-date checks.

When should I use Returns instead of Outputs on an MSBuild target?

Use Returns when you only need to pass items to calling targets without affecting incremental build checks. Outputs serves double duty as both the incremental check and the return value, while Returns only defines the return value.