0

I try to set up an application but I am facing the below error:

Nuget package restore failed for project ProjectName: Unable to find version ‘5.2.6’ of package ‘Microsoft.AspNet.Mvc’. C:/Program Files (x86)\Microsoft SDKs\NugetPackages: Package ‘Microsoft.AspNet.Mvc.5.2.6’ is not found on source ‘c:\Program files (x86)\Microsoft SDKs\NugetPackages\’. http://ncrsdk-lib.ncrcorp******** : Package ‘Microsoft.AspNet.Mvc.5.2.6’ is not found on source ‘http://ncrsdk-lib.ncrcorp.net/********’*

I tried to run the following command in the package manager console:

PM> Install-Package Microsoft.AspNet.Mvc -Version 5.2.6

I got the error some packages are missing from the solution. The package needs to be restored In order to build the dependency graph.

I clicked on the restore packages button and that gives a message unable to restore.

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Codev
  • 33
  • 8
  • That's a very odd domain as a source of NuGet packages. Have you set a different NuGet source in Tools | Options | NuGet Package Manager | Package Sources? – Richard Sep 02 '20 at 14:14
  • Hi Richard, yes I have added the package source as the link which I have shared above – Codev Sep 02 '20 at 15:19

3 Answers3

1

I cleared the package cache and added nuget.org to the package sources(was missing before) , This fixed the issue.

Source - An error occurred while trying to restore packages. Please try again

Codev
  • 33
  • 8
0

The package does not exist in the mentioned source , try to point your source to official nuget.org website , you have to options in order to force it to point to the correct one

Command Line

Install-Package Microsoft.AspNet.Mvc -Version 5.2.6 -Source https://api.nuget.org/v3/index.json

Or from Visual Studio you can select the correct source or configure a new source to point the official nuget.org enter image description here

Houssem
  • 1,042
  • 7
  • 16
  • I Tried running the above command line from the package manager console, also tried changing to Source packages to All and 'Microsoft Visual Studio Offline packages' still i see the error 'Install-Package : 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' – Codev Sep 02 '20 at 16:46
  • clearing the package cache and adding nuget.org to the package sources fixed the problem. – Codev Sep 02 '20 at 17:08
  • Great ! You can mark this answer as a solution as it's mention that you need to add nuget.org to the sources (red circle) otherwise you can improve it so it can help someone else – Houssem Sep 03 '20 at 07:04
0

From the error message looks like you are looking for a version that no longer exists and cannot tell which Package source you have selected. Its trying to download the package form "http://ncrsdk-lib.ncrcorp********" where as the package may be removed from there. Try installing the the same package from source nuget.org only.