0

I tried to create the controller by selecting "MVC controller with views using Entity Framework" option, but I get a "Package restore failed" error. I am using Visual Studio 2022 and ASP.NET Core 6.

I checked the package settings, reinstalled the packages but I don't understand the problem. The course I'm watching uses ASP.NET Core 5, I'm using ASP.NET Core 6. There was no error in it, it gave me an error.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
beyza
  • 1
  • There are several reasons could cause this error, maybe you can refer to this [link](https://stackoverflow.com/questions/63560894/package-restore-failed-rolling-back-package-changes-vs2019). – Xinran Shen Aug 28 '23 at 05:29

1 Answers1

0

What versions are you using for your NuGet Packages? Considering you are going through a course that uses ASP.NET Core 5, while you are using ASP.NET Core 6, I had a similar issue, but this error happened when I tried adding a Scaffolded Item (specifically Identity). The solution I had was

  • To re-install the NuGet packages with the latest version for your framework.
  • Since you are using .NET 6, then install the NuGet packages with the latest v6 version. (That is, if you are using packages such as EF Core)

You can check compatibility for all your NuGet packages (if their versions don't align with the .NET versions) by going to:

  1. Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
  2. Go to the Installed tab to check the installed packages.
  3. Click on each package and check for the "Report Abuse" URL on the right.
  4. Copy that URL and remove the "/ReportAbuse" part at the end of the URL.
  5. Replace "nuget.org" with "fuget.org".
  6. Press enter and you will see the FuGet website open the package.
  7. Then check for the framework compatibility.
  8. Make sure your .NET framework version is supported for that package.
Ruan
  • 1