Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to use nopCommerce(Which is written in .NET Core) but when I want to run the project I face 52 Errors telling me Run a nuget package restore

Assets file ~\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Nop.Web.MVC.Testsote

when I use the right click on the solution and selecting Restore Nuget Packages I get this message:

All packages are already installed and there is nothing to restore.

but those 52 Errors are still there and in Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution there is nothing installed on the solution,also I Recently updated my VS2017 to 15.5.4

like image 360
NeverTrust Avatar asked Jan 25 '18 10:01

NeverTrust


People also ask

How do I force a NuGet package to restore?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

What is project assets JSON file?

json file is generated in the process of restoring the NuGet packages in projects that use project. json . It holds a snapshot of all the information that is generated as NuGet walks the graph of packages and includes the version, contents, and dependencies of all the packages in your project.

How do I fix netsdk1004?

To resolve the error, remove the % from the folder name, and rerun dotnet build . A change to the project file wasn't automatically detected and restored by the project system. To resolve the error, open a command prompt and run dotnet restore on the project.

How do I reinstall NuGet Visual Studio?

In Visual Studio, the Package Manager Console provides many flexible options for updating and reinstalling packages. On the Installed tab, select a package, record its name, then select Uninstall. Switch to the Browse tab, search for the package name, select it, then select Install).


1 Answers

To fix this error from Tools > NuGet Package Manager > Package Manager Console simply run:

dotnet restore 

The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required files.

like image 158
Mostafa Bouzari Avatar answered Sep 23 '22 08:09

Mostafa Bouzari