incremental-build
Fungsinya
Skill ini mencari tahu mengapa MSBuild membangun ulang target pada build kedua ketika tidak ada yang berubah, lalu memperbaiki pengaturannya. Skill ini untuk pengembang yang build tanpa perubahannya sama lambatnya dengan build penuh.
Kapan dipakai
- โSaat build membangun ulang semuanya padahal tidak ada yang berubah.
- โSaat target kustom berjalan setiap kali alih-alih dilewati.
- โSaat build lambat di run ulang, tetapi tidak di run pertama.
Link skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/incremental-build/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya tidak mengubah apa pun, tetapi build .NET saya tetap membangun ulang seluruh proyek. Cari tahu penyebabnya dan perbaiki.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent membandingkan timestamp input dan output untuk target yang lambat, mencari input atau output yang hilang atau file yang ditulis di luar output yang dilacak, lalu mengusulkan perbaikan. Agent memeriksanya dengan dua build yang identik.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Required diagnosis output
For every diagnose or explain request, the final answer must explicitly cover
all of these points, even when the immediate cause is simply missing
Inputs/Outputs:
- the target and exact root-cause evidence;
- the actual input/output timestamp comparison;
- missing, deleted, cleaned, or rewritten outputs;
- complete inputs, including dynamic or volatile inputs;
- evaluated input/output paths and one-to-one mapping when item lists are batched;
- two identical no-change builds and the expected second-build skip/out-of-date evidence.
Do not edit unless the user asks for a fix. If a check cannot be run, label it
as an unverified check rather than omitting it or claiming success. When
Inputs or Outputs are absent, report timestamp comparison or one-to-one
mapping as not applicable โ the incremental mechanism is not engaged, not
as an unverified comparison.
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
InputsandOutputsattributes: MSBuild compares the timestamps of all files listed inInputsagainst all files listed inOutputs. 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. - 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>
<!-- This target always runs because it has no Inputs/Outputs -->
<Target Name="PrintMessage">
<Message Text="This runs every build" />
</Target>
Why Incremental Builds Break (Top Causes)
Missing Inputs/Outputs on custom targets โ Without both attributes, the target always runs. This is the single most common cause of unnecessary rebuilds.
Volatile properties in Outputs path โ If the output path includes something that changes between builds (e.g., a timestamp, build number, or random GUID), MSBuild will never find the previous output and will always rebuild.
File writes outside of tracked Outputs โ If a target writes files that aren't listed in its
Outputs, MSBuild doesn't know about them. The target may be skipped (because its declared outputs are up to date), but downstream targets may still be triggered.Missing FileWrites registration โ Files created during the build but not registered in the
FileWritesitem group won't be cleaned bydotnet clean. Over time, stale files can confuse incremental checks.Glob changes โ When you add or remove source files, the item set (e.g.,
@(Compile)) changes. Since these items feed intoInputs, the set of inputs changes and triggers a rebuild. This is expected behavior but can be surprising.Property changes โ Properties that feed into
InputsorOutputspaths (e.g.,$(Configuration),$(TargetFramework)) will cause rebuilds when changed. Switching between Debug and Release is a full rebuild by design.NuGet package updates โ Changing a package version updates
project.assets.jsonand potentially many resolved assembly paths. This changes the inputs toResolveAssemblyReferencesandCoreCompile, triggering a rebuild.Build server VBCSCompiler cache invalidation โ The Roslyn compiler server (
VBCSCompiler) caches compilation state. If the server is recycled (timeout, crash, or manual kill), the next build may be slower even though MSBuild's incremental checks pass, because the compiler must repopulate its in-memory caches.
Diagnosing "Why Did This Rebuild?"
Use binary logs (binlogs) to understand exactly why targets ran instead of being skipped.
Before recommending a fix, report this compact checklist for each target that reran:
- Actual timestamp comparison โ name the newest resolved input and oldest resolved output, with their last-write times, and state which input is newer.
- **Output existence
Pertanyaan umum
Apa arti build tanpa perubahan?
Itu build kedua tanpa pengeditan, yang seharusnya selesai cepat dengan target yang dilewati.
Apakah skill ini mengubah file tanpa bertanya?
Skill ini mendiagnosis lebih dulu, dan hanya memperbaiki jika Anda memintanya.
Mengapa nilai yang volatil menyebabkan build ulang?
Nilai seperti timestamp atau GUID acak di path output berubah di setiap build, sehingga MSBuild menganggap output baru.
Detail
Deskripsi asli dari pembuat
Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs/Outputs on custom targets, volatile properties in output paths (timestamps/GUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time buil
repo: dotnet/skills
Popularitas
- Bintang GitHub
- 5.8k
- Peringkat
- #14602
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
create-custom-agent
5.8kMembantu agent Anda membuat file agen kustom VS Code dengan alatnya sendiri, instruksi, dan serah terima ke agent lain.
create-skill
5.8kMembantu agent Anda membuat skill agent baru dengan nama yang valid, deskripsi pemicu yang jelas, dan file SKILL.md yang mengikuti standar.
csharp-scripts
5.8kMembantu agent Anda menjalankan program C# kecil sebagai satu file dengan alat baris perintah .NET, tanpa membuat proyek lengkap.
dotnet-pinvoke
5.8kMembantu agent Anda memanggil pustaka native C atau C++ dari .NET dengan benar, mencakup tanda tangan, penanganan string, memori, dan safe handle.
Skill serupa
openclaw-update
394kMembantu agent Anda memperbarui OpenClaw Gateway yang sudah ada, dengan memilih metode pembaruan yang sesuai cara pemasangannya dan menjaga sesi Anda tetap berjalan.
diagnose-gateway
394kMembantu agent Anda mencari tahu mengapa OpenClaw Gateway gagal dengan memeriksa pengaturan, channel, dan port tanpa mengubah apa pun.
crabbox-apps
394kMembantu agent Anda membuka dan menjalankan aplikasi di mesin cloud sementara, lalu menampilkan tampilannya di panel samping chat Anda.