After updating Visual Studio from 16.7.x to 16.8.2 on our Azure DevOps build server, I got this error message:
##[error]C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1005: Assets file ‘c:\agent\_work\***\obj\project.assets.json’ doesn’t have a target for ‘netstandard2.0’. Ensure that restore has run and that you have included ‘netstandard2.0’ in the TargetFrameworks for your project.
Until the update everything worked, but where in the update did something break? It took me a long time to find a similar problem report to even understand the problem. Thanks to the explanation of Jon Douglas I just needed to change my build definition to use a newer NuGet version (anything above 5.8.0) in the NuGet tool installer task:
This little change was all it took to fix the build job. I hope this helps you as well when Azure DevOps starts to throw such error messages for your projects.
Run nuget.exe update -self. Also delete bin and obj folders from your solution.
Thank you so much. This has been a pain for me lately. It seems like a lot of people have this issue but none of their solutions worked in my case because I was building on a build machine. This worked perfectly and is so easy!
Thanks, help me so much. was a perfect solution