본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)5.8k · #14598

eliminate-redundant-restores

하는 일

이 스킬은 빌드 파이프라인에서 반복되는 NuGet 복원 단계를 찾아, 빌드를 깨뜨리지 않고 필요 없는 것을 없앱니다. 빌드 스크립트가 패키지를 두 번 이상 복원하는 팀을 위한 스킬입니다.

사용하는 경우

  • ✓파이프라인이 여러 빌드 단계를 실행하고 각 단계가 패키지를 복원할 때.
  • ✓빌드 로그에 복원이 끝난 뒤 복원 출력이 다시 나타날 때.
  • ✓복원 없음 스위치를 추가하자 빌드 오류가 날 때.

스킬 링크

https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/eliminate-redundant-restores/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-msbuild/skills/eliminate-redundant-restores/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 CI 스크립트는 모든 단계에서 NuGet 패키지를 복원합니다. 빌드를 깨뜨리지 않고 반복되는 복원을 없애 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 어떤 빌드 명령이 복원하는지 찾고, 이후 단계가 앞선 복원으로 이미 충분한지 확인한 뒤, 안전한 곳에만 복원 없음 스위치를 추가합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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/msbuild steps 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.rsp or the active MSBuild installation's MSBuild.rsp contains -restore
  • Someone asks where --no-restore or -restore:false can safely be added
  • NETSDK1004 or NETSDK1047 appeared after --no-restore was 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, then build-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.rsp beside the active MSBuild executable, or response files passed explicitly with @file. A repository-local MSBuild.rsp is 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... or All projects are up-to-date for restore. once per invocation.
  • Binlog evidence: restore evaluations carry the global properties MSBuildRestoreSessionId and ExcludeRestorePackageImports=true; the Target Performance Summary lists Restore with 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
자주 묻는 질문

느린 첫 복원도 빨라지나요?

아니요. 이 스킬은 느린 첫 복원이 아니라 반복되는 복원을 겨냥합니다. 첫 복원 속도는 캐시 문제입니다.

복원 없음 오류는 왜 생기나요?

앞선 복원이 다루지 않은 단계에 스위치를 추가하면 오류가 나므로, 스킬이 먼저 범위를 확인합니다.

버전 오류도 다루나요?

아니요. 버전이나 잠금에 관한 복원 오류는 복원 자체에서 고칩니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
5.8k
순위
#14598
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬