eliminate-redundant-restores
Fungsinya
Skill ini menemukan langkah restore NuGet yang berulang dalam pipeline build dan menghapus yang tidak diperlukan, tanpa merusak build. Skill ini untuk tim yang skrip build .NET-nya memulihkan paket lebih dari sekali.
Kapan dipakai
- ✓Saat pipeline menjalankan beberapa langkah build dan setiap langkah melakukan restore paket.
- ✓Saat log build menampilkan output restore lagi setelah restore sudah berjalan.
- ✓Saat menambahkan opsi no-restore menyebabkan error build.
Link skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/eliminate-redundant-restores/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
“Skrip CI kami melakukan restore paket NuGet di setiap langkah. Hapus restore yang berulang tanpa merusak build.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menemukan perintah build mana yang melakukan restore, memeriksa langkah berikutnya mana yang sudah dicakup restore sebelumnya, lalu menambahkan opsi no-restore hanya di tempat yang aman.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Eliminate Redundant Restores
A no-op restore still evaluates every project and checks restore state, so each extra restore in a multi-step build costs seconds to tens of seconds in a large repo. The cure is easy to get wrong: --no-restore on a step that no earlier restore actually covered turns a slow build into a failed one. This skill finds which invocations restore, proves which are already covered, and changes only those.
When to Use
- A pipeline or script runs several
dotnet/msbuildsteps and the log shows restore output in more than one of them - A restore step exists, yet later steps still print
Determining projects to restore... - A repository
Directory.Build.rspor the active MSBuild installation'sMSBuild.rspcontains-restore - Someone asks where
--no-restoreor-restore:falsecan safely be added NETSDK1004orNETSDK1047appeared after--no-restorewas added
When Not to Use
- The first restore is slow (feed latency, missing package cache): that is caching, not redundancy
- There is only one restore across all invocations: nothing to deduplicate
- Restore errors about versions, lock files or auditing: fix the restore itself
- Unranked "why is my build slow": start with
build-perf-baseline, thenbuild-perf-diagnostics
Inputs
Discover repository inputs in the working directory; do not ask the user for paths.
- CI definitions (
*.yml,.github/workflows,azure-pipelines*.yml,Jenkinsfile) and build scripts (build.cmd,build.sh,build.ps1,eng/) Directory.Build.rsp,Directory.Build.props/.targets,NuGet.config- Auto-loaded
MSBuild.rspbeside the active MSBuild executable, or response files passed explicitly with@file. A repository-localMSBuild.rspis not auto-loaded - Restore evidence if present: step logs or a binlog
Workflow
Step 1: Confirm restore is repeated and worth removing
- Log evidence:
Determining projects to restore...orAll projects are up-to-date for restore.once per invocation. - Binlog evidence: restore evaluations carry the global properties
MSBuildRestoreSessionIdandExcludeRestorePackageImports=true; the Target Performance Summary listsRestorewith N calls. - Quantify each no-op restore. If there is one restore, or the repeated ones total about a second, report "nothing worth removing" and stop without editing.
Step 2: Inventory every invocation in execution order
| Invocation | Restores? |
|---|---|
dotnet build, test, publish, pack |
Implicitly, unless --no-restore; also check inherited rsp flags |
dotnet run |
Implicitly before building; --no-restore can still inherit rsp restore on older SDKs. With --no-build, no build or restore runs |
dotnet test, publish, pack with --no-build |
No implicit restore, but an rsp -restore can still enable restore; add --no-restore -restore:false |
dotnet msbuild, msbuild.exe, CI MSBuild tasks |
With -restore or -t:Restore, including flags inherited from repository Directory.Build.rsp or installation-level MSBuild.rsp, even when a step looks build-only |
dotnet restore, nuget restore, msbuild -t:Restore |
Explicit restore |
| CI build task with a "restore packages" option | Check its default |
Starting with .NET SDK 9.0.1xx, --no-restore forwards -restore:false to override rsp flags; older SDKs can still inherit -restore despite skipping the CLI's implicit restore. Whenever an rsp enables restore, use the version-independent --no-restore -restore:false with dotnet build, test, publish or pack, even with --no-build. dotnet msbuild and msbuild.exe take -restore:false, not --no-restore.
dotnet run does not expose the MSBuild -restore:false override. With an rsp on older SDKs, first build using dotnet build --no-restore -restore:false, then run using dotnet run --no-build with the same project, configuration, framework and runtime inputs (or execute the built DLL directly). Passing -restore:false to dotnet run is not a restore-suppression strategy.
Step 3: Decide per invocation
Keep the first restore. Skip a later one only when all four checks pass:
| Check | If it fails |
|---|---|
Same project set. A restore covers its entry project or solution and that project's ProjectReference closure. It does not cover a project in another solution or .slnf, a tool built from another path, or a project an orchestrating .proj builds through the `MSBuil |
Pertanyaan umum
Apakah ini mempercepat restore pertama yang lambat?
Tidak. Skill ini menargetkan restore yang berulang, bukan restore pertama yang lambat, yang merupakan masalah cache.
Mengapa saya mendapat error no-restore?
Error muncul jika opsi ditambahkan ke langkah yang tidak dicakup restore sebelumnya, sehingga skill memeriksa cakupan lebih dulu.
Apakah skill ini mencakup error versi?
Tidak. Error restore tentang versi atau lock diperbaiki pada restore itu sendiri.
Detail
Deskripsi asli dari pembuat
Remove repeated NuGet restores from multi-step .NET builds safely. USE FOR: build/test/publish steps that each restore, Directory.Build.rsp with -restore, safe restore suppression, NETSDK1004/NETSDK1047 after --no-restore. DO NOT USE FOR: slow first restore, only one restore, version or lock errors, unranked build slowness (use build-perf-baseline).
repo: dotnet/skills
Popularitas
- Bintang GitHub
- 5.8k
- Peringkat
- #14598
- 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.