Kirsten
Kirsten

Reputation: 18066

Some NuGet packages are missing from the solution in Visual Studio Application

After pulling some code updates I found I got this message when building.

Some NuGet packages are missing from the solution. 
The packages need to be restored in order to build the dependency graph. 
Restore the packages before performing any operations

In solution explorer the references links displayed with a missing reference icon

I deleted the references Then at the package manager console a button appeared asking if I wanted to install the missing packages. However, this did not work.

Upvotes: 7

Views: 25397

Answers (5)

Ercan
Ercan

Reputation: 405

If you live that problem on some server, maybe that server can't reach to internet.

If you want to pass missing restore error, you can do uncheck to this option.

Or you have to enable that server to access the internet.

enter image description here

Upvotes: 0

jainashish
jainashish

Reputation: 5183

I am writing this answer as I tried the below solutions but none of them worked :

  1. Clearing the cache
  2. Restoring or re-installing the packages
  3. Changing the targetFramework
  4. Updating the Nuget Package manager

Then I looked upon a dropdown list and it appeared the error was trivial. The package source was offline !! I installed VS2017 professional on my system and opened an existing project and found that multiple packages were missing. I tried everything I could, without looking at Package Source !!

Manage Nuget Packages for Solution


Solution:

Step 01. Go to Package Manager Settings (Tools > Nuget Package Manager > Package Manager Settings) Nuget Package Manager > Package Manager Settings

Step 02. Check the Package Source(s). As you can see, the package source is here already downloaded SDK/nugets/packages. I don't know the reason but the online package source from nuget.org was missing from my system installation of Visual Studio.

enter image description here

Step 03. Install the nuget.org as package source and then 'Clear All Nuget Cache(s)' and then restore the packages. The error will go away.

Name: nuget.org ( or as you wish) Source: https://api.nuget.org/v3/index.json

enter image description here

Upvotes: 21

Sarcel
Sarcel

Reputation: 27

It's possible that folder/zips content error during the first download so go to the Xamarin folder (C:/User/YourName/AppData/Local/Xamarin) and delete or rename or move out the folder of missing nuget or content the of zips folder.

Restart the IDE, your IDE download again the content. I tried this and it works.

Upvotes: 1

Kirsten
Kirsten

Reputation: 18066

When I tried opening the project on its own , outside the solution, and buidling it I received the message.

One or more NuGet packages need to be restored but couldn't be because consent has not been granted. To give consent, open the Visual Studio Options dialog, click on the Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'.

I granted VS the permission, then I ran at the package manager console

update-package -Reinstall  

Upvotes: 7

I_Al-thamary
I_Al-thamary

Reputation: 3993

Click Ctrl+Q and write the name of the missing package and then click search for online NuGet package matching . It will show menu click on browse that will give you the missing package click install ,uninstall or update. enter image description here

Upvotes: 1

Related Questions