How to Fix “Error NETSDK1005 Assets File project.assets.json Doesn’t Have a Target for netstandard2.0”

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:

In the NuGet tool installer task, change the version of NuGet to 5.8.x or higher

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.

4 thoughts on “How to Fix “Error NETSDK1005 Assets File project.assets.json Doesn’t Have a Target for netstandard2.0””

  1. 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!

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.