Showing posts with label NuGet. Show all posts
Showing posts with label NuGet. Show all posts

February 20, 2020

Assets file project.assets.json not found. Run a NuGet package restore

In Visual Studio 2017, while working with .Net Core Web Applications, I encountered this error:

Assets file project.assets.json not found. Run a NuGet package restore

While searching for this, I found a number of options you can try to fix this issue.

  1. Simplest of the solution could be just to close and re-open the Visual Studio, in some cases this might help.

  2. Another thing could be simply delete the bin and obj folders, clean and rebuild the solution.

  3. Go to Tools > NuGet Package Manager > Package Manager Console, and run this command:

    dotnet restore
    

    Or for specific project:

    dotnet restore [project or solution name]
    

    Executing dotnet restore adds all the required files.

  4. If simply restoring NuGet packages does not work make sure in Tools > Options > NuGet Package Manager > General under Package Restore that the Allow NuGet to download missing packages is checked.

    Then try restore packages, and rebuild after deleting obj and bin folders

  5. Try clearing the Nuget cache.

    Go to Tools > Options > NuGet Package Maneger > General > click on Clear All Nuget Cache(s)

  6. Run command dotnet build.

    dotnet build
    

    It runs the restore by default.