Microsoft.PackageDependencyResolution.targets: [NETSDK1004] Assets file ‘C:\MyProject\src\obj\project.assets.json’ not found. Run a NuGet package restore to generate this file.
Feb 4, 2022
I came across this error while upgrading some libraries to .net6.0 and .Net Framework 4.7.2. As I use Paket in preference to Nuget, the suggested solution did not help, nor did clearing out the obj folder.
Thankfully I did find a fairly simple solution which eliminated the issue. Simply add a global.json file to your project. In my case I use
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestPatch",
"allowPrerelease": false
}
}
and all is well. This has not been tested while using nuget but it may well work in that case too.