Can't restore NuGet Packages

18,057

Solution 1

I just updated my Visual Studio 2017 from 15.6.4 to 15.7.2. It helped with packages, in my case.

Solution 2

Right-click on the Solution and click Restore NuGet Packages

Or try running this command in the folder that has your solution file:

dotnet restore

Or

nuget restore

Solution 3

I had similar issues once where it turned out that the Android SDK that was referenced was not installed. Maybe look in that direction?

Share:
18,057
Сергей
Author by

Сергей

Изобретатель велосипедов, строитель костылей.

Updated on July 25, 2022

Comments

  • Сергей
    Сергей almost 2 years

    I downloaded a Xamarin Solution from TFS and now need to restore the NuGet packages. I tried to do it like this :

    Update-Package -reinstall -Project ProjectName
    

    But it didn't work and I got this message:

    This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.

    enter image description here

    How can I restore the NuGet packages? I tried to manually download android_m2repository, Clean Solution, delete bin/obj, rebuild - NOT WORKING, still :

    An error occurred trying to install required android components on Project

    UPD : I tried also Update-Package –reinstall - not worked :

    This project references NuGet package(s) that are missing on this computer.

  • phanikurla
    phanikurla about 6 years
    This might help you.. check this thread. stackoverflow.com/questions/27895504/…
  • phanikurla
    phanikurla about 6 years
    Another way of fixing your issue: All you need to do is create a NuGet.Config file next to your .sln file, containing: <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="nuget.org/api/v2" /> <add key="aspnetwebstacknightlyrelease" value="myget.org/f/aspnetwebstacknightlyrelease" /> </packageSources> </configuration>
  • Сергей
    Сергей about 6 years
    when i did so, i got new error : NuGet Package restore failed for project -myproject-: Unable to find version '1.0.39.113' of package..
  • Iain Smith
    Iain Smith about 6 years
    Is that package in a private NuGet feed? If so you might need to get login details or access to the private NuGet feed
  • Сергей
    Сергей about 6 years
    I drop this package and Restore nuget : All packages are already installed and there is nothing to restore. but when I try to Build project get error again -> This project references NuGet package(s) that are missing on this computer.
  • VahidShir
    VahidShir about 6 years
    Since "All packages are already installed" what if you clean the solution, delete obj/bin folders, and Unload/reload projects?
  • Emil
    Emil almost 5 years
    dotnet restore works but nuget restore not. what is the difference?
  • 15ee8f99-57ff-4f92-890c-b56153
    15ee8f99-57ff-4f92-890c-b56153 about 4 years
    As @Сергей Notes, none of these suggestions does anything at all.