Error : Package restore failed
I am trying to add controller to my solution in Asp.net Core project.
While doing so i am getting this error.
I am getting the same message for adding minimal dependencies and full dependencies for controller.
Please help me with this issue. Thanks in advance.
I also had this issue. "Add Controller>API Controller with actions, using Entity Framework" would give the "Package Restore Failed" error.
As Anish stated, it seems to be due to package versions being mis-aligned. I was able to resolve this issue using "Manage NUGET Packages for Solution", then performing an "Update All". This set my AspNetCore version to 2.1.5 and resolved my "Package Restore Failed" error, but then led to another error, "NETCore version 2.1.5 not found". Apparently the scaffolding code generator needs the AspNetCore and the NETCore versions to be in sync, so I manually downloaded and installed the NETCore version 2.1.5 from Microsoft Downloads. This worked, and I was finally able to generate Controllers.
I was getting the same error while making a new controller. I've fixed it like this. Actually, VS only had the Offline Package source and could not resolve the packages needed.
Add the online reference: Tools > nuget package manager > package manager settings > Package Sources
Add source: https://api.nuget.org/v3/index.json