dotnet error: Unable to read a package reference from the project

Umer IslamUmer Islam
1 min read

when you try to view all the packages installed in your project by using the command:

dotnet list package

and get the following error:

Unable to read a package reference from the project `C:\reallyLongListOfDirectories\jwt_auth\jwt_auth.csproj`.Please make sure that your project file and project.assets.json file are in sync by running restore.

Solution:

simply delete the file:
obj>project.assests.json

after deleting the file run the following command:

dotnet restore
dotnet list package

This usually solves the problem, in case it doesn’t work. Please make sure of the following:

  1. Your local server should NOT be running.

  2. Your project is configured properly.

  3. If a package is being added, it can cause the error wait for a moment and try again.

0
Subscribe to my newsletter

Read articles from Umer Islam directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Umer Islam
Umer Islam