Problem
I’m getting the below error when I trying to add the NewtonsoftJson package to asp.net web API core 3.1 project
Package restore failed. Rolling back package changes
Solution
It was an issue while installing the NewtonsoftJson package to my asp.net core API 3.1v project, so I tried to clear the cache of the All NuGet packages and restarted the visual studio.
After I cleared the cache, I was able to download the NuGet package API into my asp.net core project.
Summery
Clear of NuGet packages cache can also solve the problems when we are failing to install the new NuGet packages to our asp.net core projects.
This solution is not working for me 🙁
if your project version is 5 then same NuGet packages version install above blow. And then check again
net5.0
all
runtime; build; native; contentfiles; analyzers; buildtransitive