Package restore failed. Rolling back package changes VS2019

Viewed 9211
5 Answers

I had the same issue while adding the view for an IActionResult in .net 5.0 MVC using VS2019, before updating all the installed packages.

For me, restarting the Visual Studio works.

After restart I tried again, auto scaffolding installed this package "Microsoft.VisualStudio.Web.CodeGeneration.Design" along with generating a View.

1 - Go to Tools

2 - Options

3- NuGet Package Manager

4- General

5 - Clear All NuGet Cache(s)

There are a couple of reasons that might account for this behaviour. Some of the reasons, as I have experienced on different occasions, include but might not be limited to the following:

  1. Outdated Visual Studio Environment: In this case, you might attempt to update your version of VS.

  2. Outdated Packages: In this case, update some or all of the packages in your project. To do this, go to Tools -> Nuget Package Manager -> Manage Nuget Package for Solution. Choose the packages that you want to update. if you are not sure, check Select all packages

In my case I needed to create an API controller and the only solution that worked for me was to download from the visual studio installer, in the individual features section: all the features of the SKD.NET framework, all the .NET Framework support packages, ASP.NET and web development tools, and a few SQL features that I need.

Related