The package restore failed. Rolling back package changes in VS2019 for asp.net core. When,I try to add API Controller using EF. This didn't work for me -Try to Clear All Nuget Caches , -Try clearing the ComponentModelCache Can't Add View from Controller in VS 2015 : "There was an error running the selected code generator" It does not solve this error.
can anyone help me?
In Visual Studio on Windows, you can restore packages automatically or manually. First, configure Package Restore through Tools > Options > NuGet Package Manager.
Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.
MSBuild -t:restore (which nuget restore and dotnet restore use with . NET Core projects), restores packages referenced in the project file as follows: Read all project to project references.
This error indicates that package restore is disabled in your NuGet configuration. You can change the applicable settings in Visual Studio as described earlier under Quick solution for Visual Studio users.
Rolling back package changes This article discusses what to do when your package restore fails. 1. In Visual Studio 2019, goto Tools > Options > Nuget Package Manager > Package Manager Setting > General > Clear All Nuget Cache (s).
Rolling back package changes once you get this msg open your output window. it will show all the packages it installed and where it has failed and started restoring. From there you will be able to debug it. For people who are getting error for Microsoft.AspNetCore.All. please go to project>properties>application>target Framework.
(In Visual Studio, the references appear in Solution Explorer under the Dependencies \ NuGet or the References node.) To follow the required steps to restore packages, see Restore packages.
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.
For EF Core packages version 5.0.5 I was only able to solve this using the command line tool. See answer by johanjuulj here Visual Studio error: There was an error running the selected code generator
dotnet aspnet-codegenerator controller -m MyModel -dc MyDbContext -name MyModelssController -async
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:
Outdated Visual Studio Environment: In this case, you might attempt to update your version of VS.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With