Guide for optimizing MSBuild incremental builds. Only activate in MSBuild/.NET build context. USE FOR: builds slower than expected on subsequent runs, 'nothing…
How MSBuild Incremental Build Works
MSBuild's incremental build mechanism allows targets to be skipped when their outputs are already up to date, dramatically reducing build times on subsequent runs.
Targets with Inputs and Outputs attributes: MSBuild compares the timestamps of all files listed in Inputs against all files listed in Outputs. If every output file is newer than every input file, the target is skipped entirely.
Without Inputs/Outputs: The target runs every time the build is invoked. This is the default behavior and the most common cause of slow incremental builds.
Incremental attribute on targets: Targets can explicitly opt in or out of incremental behavior. Setting Incremental="false" forces the target to always run, even if Inputs and Outputs are specified.
Timestamp-based comparison: MSBuild uses file system timestamps (last write time) to determine staleness. It does not use content hashes. This means touching a file (updating its timestamp without changing content) will trigger a rebuild.
<!-- This target is incremental: skipped if Output is newer than all Inputs -->
<Target Name="Transform"
Inputs="@(TransformFiles)"
Outputs="@(TransformFiles->'$(OutputPath)%(Filename).out')">
<!-- work here -->
</Target>don't have the plugin yet? install it then click "run inline in claude" again.
by @dotnet