xariez
xariez

Reputation: 547

I found invalid data while decoding error updating NuGet packages

I have been trying to update NuGet packages in Visual Studio 2019 from both package manager consoles and the manage NuGet packages from the context options, but in both cases I get "Found invalid data while decoding." error.

I have to revert to Visual Studio 2017 to update. Is there a way to deal with this or do I have to contend with this switching for now?

The error outputs are as below for both scenarios:

Enter image description here

Upvotes: 32

Views: 18846

Answers (2)

CThru
CThru

Reputation: 726

Visual Studio 2019

  1. Go to menu ToolsNuGet Package ManagerPackage Manager Console.
  2. Type dotnet nuget locals all --clear.
  3. Clean the solution.
  4. Delete the bin and obj folders from the project folder.

It is 100% working.

Upvotes: 71

Tim
Tim

Reputation: 875

Deleting the obj and bin folders in each project in my solution, then reopening Visual Studio 2019 to trigger automatic package download worked for me. I don't think you need to remove bin as well but I was going crazy at that point.

Upvotes: 3

Related Questions