1
votes

I cannot update the nuget packages in my solution. I always get the error:

"Package Restore Failed. Rolling back package changes."

Here is a screenshot of the packages:

enter image description here

2
have you tried 'dotnet restore' from the command line?d.moncada
I've tried both 'dotnet restore' on console and 'Restore NuGet Packages' on the Solution but still does not resolve the update errors.jengfad
Sometimes a Visual Studio Restart is required. But if it still doesn't work you have to post the error messages from the Package manager console, its hard to help you w/o a clear description of the issueTseng
Is there exist global.json in you project folder? Are you migrating you project from .net core 1.1 to .net core 2.0 ? I have the same issue with you when I migrating.doublnt
What`s your target framework? .NET Core 1.1 or .NET Core 2.0? If you want to update those packages, you should change your target framework to .NET Core 2.0.Leo Liu-MSFT

2 Answers

1
votes

I was able to fix this issue by repairing my current installation of netcore 2.0 SDK.

1
votes

If there is anybody looking for alternative solutions you can follow my answer.

Recently I came across this problem when I cleared the NuGet caches in the project.

I was able to restore the packages only after moving the project files to a directory with a shorter length.

Example:
Initial project path (package restoration failed):
D:\Folder01\Folder02\Folder03\TheProjectFolder

New file path (package restoration succeeded):
D:\TheProjectFolder

By changing so, you will be able to restore the NuGet packages, and having finished again you can move the project to the previous location.

This was the only solution that enabled the NuGet package manager restoration. (Sometimes in the error console it will output different errors. But the root course for all the errors is the length of the folder path. It hinders the restoration of NuGet packages)