NuGet Package Restore ↔ Git Source Control: Deterministic Build Interoperability
0 reputation · 17 Jan 2023, 14:21 UTC
0 reputation · 17 Jan 2023, 14:21 UTC
NuGet 4.8+ provides the packages.lock.json file to capture exact versions of direct and transitive dependencies. When committed to Git, this file allows dotnet restore to ensure that every developer and CI agent uses the same dependency graph, preventing issues where floating version ranges resolve to different patch versions across environments.
A challenge arises when the infrastructure surrounding the lock file changes. Because the lock file encodes the specific source URLs used during its creation, there is a tight coupling between the committed lock file and the nuget.config file. This creates uncertainty when migrating feeds or updating internal mirror URLs.
To verify repeatability, a clean workstation environment—where the %userprofile%\.nuget\packages folder is deleted—is typically used to ensure the restore process relies solely on the lock file and configured feeds.
The following points remain unresolved regarding this integration:
nuget.config is updated after a lock file is committed, does dotnet restore fail due to the source mismatch in the lock file, or does it resolve the locked version from the new URL?A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.