Enabling NuGet Package Restore ensures your project automatically downloads missing dependencies before build. Here’s how to do it depending on your setup.
In Microsoft Visual Studio:
Enable globally
• Go to Tools → Options
• Navigate to NuGet Package Manager → General
• Check:
- Allow NuGet to download missing packages
- Automatically check for missing packages during build
Enable per solution
Right-click the solution
Select Restore NuGet Packages
Or:
Right-click solution → Manage NuGet Packages → Restore
For SDK-style projects (most .NET Core / .NET 5+), restore is automatic.
Just run:
dotnet restore
Using .NET CLI
You usually don’t need to enable anything—restore happens before build.
Using .NET CLI
dotnet restore
Using NuGet CLI
nuget restore YourSolution.sln
In build pipelines:
msbuild YourSolution.sln /t:Restore
Or:
dotnet build
(which includes restore automatically)
For legacy projects:
Right-click solution
Click Enable NuGet Package Restore (older Visual Studio versions)
This creates:
• .nuget folder
• NuGet.config
• nuget.exe
Modern setups already do this, but ensure:
<RestorePackages>true</RestorePackages>
(rarely needed today)
Packages not restoring?
Run:
dotnet restore --force
Clear cache:
dotnet nuget locals all --clear
To enable Nuget Package Restore, first check if package restore is enabled from the visual studio options.
Open visual studio and follow the steps given below:
Tools / Options / NuGet Package Manager / Allow NuGet to download missing packages
Lastly check the checkbox for "Allow NuGet to download missing packages" as shown in the following image.

If it is already enabled open Nuget Package Manager console:
Tools / NuGet Package Manager / Package Manager Console
Run the command
Install-Package NuGetEnablePackageRestore
You may get the result
========================
NuGet Enable Package Restore Fix
========================
To fix package restore:
1. Please enable package restore in Visual Studio FIRST.
2. Run the command: Install-NuGetEnablePackageRestoreFix
3. Restart Visual Studio.
This should fix that pesky broken build you are experiencing.
Then, just run the command
Install-NuGetEnablePackageRestoreFix
and restart Visual Studio.