NuGet Package Restore Failed — Visual Studio Dependency Resolution Errors
About NuGet Package Restore Failed
Fix NuGet package restore failures in Visual Studio caused by missing package sources, version conflicts, authentication issues, and proxy configurations. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: NuGet package restore downloads project dependencies before building in Visual Studio. Restore failure causes cascading build errors — 'type or namespace not found' for every dependency. Package sources can be nuget.org, private feeds, or local directories. Package version conflicts between projects in the same solution cause restore failures. Authentication is required for private NuGet feeds (Azure DevOps, GitHub Packages, JFrog). Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: nuget.org unreachable due to network issues, proxy, or firewall blocking. Private NuGet feed credentials expired or not configured. Package version conflict: two projects requiring incompatible versions of the same package. packages.config or .csproj referencing a package version that does not exist on any configured source. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check NuGet sources: Visual Studio > Tools > NuGet Package Manager > Package Manager Settings > Package Sources — verify nuget.org is listed. Clear NuGet cache: 'dotnet nuget locals all --clear' in terminal, or Tools > NuGet Package Manager > General > Clear All NuGet Cache(s). Restore from command line: 'dotnet restore' in the solution directory for detailed error output. For private feeds: configure credentials in Visual Studio or nuget.config file. Resolve version conflicts: use Directory.Packages.props (Central Package Management) to enforce consistent versions. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Windows Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
Where is the NuGet cache?
Global packages: %USERPROFILE%\.nuget\packages. HTTP cache: %LOCALAPPDATA%\NuGet\v3-cache. Temp: %LOCALAPPDATA%\NuGet\Temp. Clear all with 'dotnet nuget locals all --clear'.
Overview
Fix NuGet package restore failures in Visual Studio caused by missing package sources, version conflicts, authentication issues, and proxy configurations.
Key Details
- NuGet package restore downloads project dependencies before building in Visual Studio
- Restore failure causes cascading build errors — 'type or namespace not found' for every dependency
- Package sources can be nuget.org, private feeds, or local directories
- Package version conflicts between projects in the same solution cause restore failures
- Authentication is required for private NuGet feeds (Azure DevOps, GitHub Packages, JFrog)
Common Causes
- nuget.org unreachable due to network issues, proxy, or firewall blocking
- Private NuGet feed credentials expired or not configured
- Package version conflict: two projects requiring incompatible versions of the same package
- packages.config or .csproj referencing a package version that does not exist on any configured source
Steps
- 1Check NuGet sources: Visual Studio > Tools > NuGet Package Manager > Package Manager Settings > Package Sources — verify nuget.org is listed
- 2Clear NuGet cache: 'dotnet nuget locals all --clear' in terminal, or Tools > NuGet Package Manager > General > Clear All NuGet Cache(s)
- 3Restore from command line: 'dotnet restore' in the solution directory for detailed error output
- 4For private feeds: configure credentials in Visual Studio or nuget.config file
- 5Resolve version conflicts: use Directory.Packages.props (Central Package Management) to enforce consistent versions