Assets file 'project.assets.json' not found in Asp.net Core

Dung Do Tien Feb 26 2022 344

Hello, I have created a Unit Test project with NUnit in VS2019. But after creating, the project can not load Nunit package as below:

 Assets file 'project.assets.json' not found in Asp.net Core 

I try to clear and build the project but I got the error NETSDK1004 Assets file 'GoogleNotification.UnitTest\obj\project.assets.json' not found.

 Severity    Code    Description    Project    File    Line    Suppression State
Error    NETSDK1004    Assets file 'C:\Users\conta\source\repos\Test.GoogleNotification\Test.GoogleNotification.UnitTest\obj\project.assets.json' not found. 
Run a NuGet package restore to generate this file.    
Test.GoogleNotification.UnitTest    
C:\Program Files\dotnet\sdk\5.0.211\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets    241    

I also tried to find project.assets.json file, but I can not find it in my project.

I re-installed 3 packages above but it still throws the same error. How can I solve it?

Thanks for any solution.

Have 2 answer(s) found.
  • P

    Phúc Lê Khắc Feb 26 2022

    You need to restore the package of this project. To solve this issue you can choose Tools > NuGet Package Manager > Package Manager Console

    In Default Project combobox, you have to choose your unit test project, and run the command below:

     dotnet restore

    The issue will be solved!!

  • M

    Mohannad mostafa Feb 26 2022

    From the menu of VS2019 select Tools > NuGet Package Manager > Package Manager Console

    And then Run:

     dotnet restore <project or solution name>

    It will fix the issue for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close