CI: enable NuGet caching to cut restore from ~60s#925
Merged
erikdarlingdata merged 1 commit intodevfrom May 2, 2026
Merged
Conversation
The Restore dependencies step on every CI run takes ~1 minute because nothing caches NuGet packages between runs. setup-dotnet@v4 has a built-in cache option that uses packages.lock.json as the cache key — on a hit, restore drops to ~5-10s. - Add cache: true and cache-dependency-path to actions/setup-dotnet in build.yml and nightly.yml. - Generate packages.lock.json for Dashboard, Lite, Installer, Installer.Core, and Lite.Tests via dotnet restore --use-lock-file. - Switch the restore commands to --locked-mode so CI fails fast if someone forgets to commit an updated lock file (instead of silently resolving transitive packages and bypassing the cache key). The lock files double as a supply-chain check — package versions are now pinned across the graph, not just the direct refs in csproj. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Restore dependencies step on every CI run takes ~1 minute because nothing caches NuGet packages between runs.
setup-dotnet@v4has a built-in cache option that usespackages.lock.jsonas the cache key — on a hit, restore drops to ~5–10s.Changes
cache: trueandcache-dependency-path: '**/packages.lock.json'toactions/setup-dotnet@v4in bothbuild.ymlandnightly.yml.packages.lock.jsonfor Dashboard, Lite, Installer, Installer.Core, and Lite.Tests viadotnet restore --use-lock-file.--locked-modeso CI fails fast if someone forgets to commit an updated lock file (instead of silently resolving transitive packages and bypassing the cache key).The lock files double as a supply-chain check — package versions are now pinned across the graph, not just the direct refs in csproj.
Notes
dotnet add package X(auto-updates lock file) ordotnet restore --use-lock-filemanually before pushing. CI will fail with--locked-modeif the lock file is stale, which is the desired safety.Test plan
dotnet restore --locked-modeworks locally for all 4 projectsdotnet build --no-restoreworks locally after locked restore🤖 Generated with Claude Code