1
votes

when generating a new project xamarin.form prism I get this error when running. With the previous version 2.1.7 it worked for me OK. It does not allow me to open the Nuget Package since it also gives an error. Any recommendation? I saw the 2 posts of this error but they do not apply to me.

Error NETSDK1004 Assets file 'C:\Empresas\Job_Facu\Job\Job.Prism\Job.Prism\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Job.Prism C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234

2

2 Answers

1
votes

The error tells you what to do. Run a NuGet restore. Visual Studio should help you do this automatically. Note that if this occurred after updating dependencies sometimes Visual Studio gets confused and it's best to close Visual Studio and reopen it. This usually gets it to refresh itself so you get the updated package restore.

If that's not working for you, you can download the latest nuget.exe and from the command line navigate to the solution directory and execute the command {path to nuget.exe} restore.

When NuGet performs a restore it generates the project.assets.json file in the obj folder of each project it has restored. This in turn provides MSBuild with the reference information it needs to properly reference your dependencies like Prism and Xamarin.Forms.

0
votes

I have recently ran into similar issue as well, seemingly out of the blue. I believe upgrading my build machine to the latest VS version (VS for Mac 8.10.4 (build 11))

NETSDK1004: */project.assets.json' not found. Run a NuGet package restore to generate this file.

To fix, I had to run Nuget Restore twice. Once for the shared project directory and once for the iOS project.

If I run the restore just for the Shared/(main.sln file) project directory I get the error.

If I run the restore for the iOS project the build passes but IPA file isn't created.

Need to run both.

Modules used for CI/CD build in Azure Devops Pipeline