🔧 The Restore That Only Worked on One Specific Laptop
A solution that restores its NuGet packages cleanly for one developer and fails with unresolved package errors for another, on the exact same commit, almost always comes down to a difference in what each machine’s NuGet configuration considers a valid package source – a private feed reachable only on a corporate VPN, a locally-cached package that exists in one developer’s global packages folder but was never actually published anywhere a fresh machine could reach it, or a nuget.config file that references a feed URL correctly for one person’s authentication setup and not the other’s. The solution file and the project files are identical for both people; what differs is invisible, machine-local configuration that never gets committed to source control at all.
🔎 The Problem
Developer A (restore succeeds):
- VPN connected, has access to the internal NuGet feed at
https://nuget.internal.company.com/v3/index.json
- That feed is listed in %AppData%\NuGet\NuGet.Config - a
machine-level file, NOT part of the repository
Developer B (restore fails, same commit, same solution):
- Not on VPN at the moment, or never had that feed added to
their own local NuGet.Config in the first place
- Visual Studio reports packages as "not found" purely because
THIS machine's list of package sources doesn't include the
one place those specific packages actually live
Nothing about the project files differs between the two - the
missing piece lives entirely in machine-local configuration that
git has no way to see or track.
✅ Fix: Make the Package Source List Part of the Repository, Not the Machine
- Adding a nuget.config file at the solution root, committed to the repository, with every required package source (including internal feeds) listed explicitly, removes the dependency on each individual developer’s own machine-level NuGet configuration having been set up correctly and identically.
- Documenting any required VPN or network access needed to reach an internal feed directly in the project’s onboarding notes, right next to the committed nuget.config, turns a confusing ‘restore just doesn’t work for me’ report into an obvious, checkable first step for a new team member.
- Running dotnet nuget list source (or checking Visual Studio’s NuGet Package Manager > Package Sources settings) on a failing machine quickly reveals exactly which sources that specific installation considers valid, making the comparison against a working machine’s list fast rather than guesswork.
⚠️ Why This Looks Like a Project Problem and Isn’t
- NuGet package sources are, by default, a per-machine (or per-user) setting rather than something stored inside the solution or project files – which is exactly why two people can have an identical checkout of the exact same commit and get completely different restore results.
- This is especially common right after a new developer joins a team, or after a work laptop is reimaged or replaced, since both situations start from NuGet’s default configuration with none of the project-specific feeds anyone else already quietly added to their own machine months ago.
A NuGet restore failure that only happens on one machine isn’t a broken project – it’s a project that’s been quietly depending on configuration nobody ever told git about.
