NETSDK1005 error building .NETStandard 2.0 project on Azure DevOps

Joe Manke 1,091 Reputation points
2020-11-20T19:49:25.927+00:00

Doing continuous integration builds using a hosted agent in Azure DevOps, I now have builds failing with error NETSDK1005. Microsoft documentation notes this as a known issue that occurs when using preview versions of .NET 5 and Visual Studio 16.8, but I assume hosted agents should be using stable versions.

This is the error message from the logs (repeated for several projects):

[error]C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1005: Assets file 'D:\a\1\s\PROJECTNAMEHERE\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.

Build agent information from the logs:

2020-11-20T19:32:33.0530259Z ##[section]Starting: Initialize job
2020-11-20T19:32:33.0531868Z Agent name: 'Azure Pipelines 4'
2020-11-20T19:32:33.0532328Z Agent machine name: 'fv-az686-598'
2020-11-20T19:32:33.0532610Z Current agent version: '2.177.1'
2020-11-20T19:32:33.0827960Z ##[group]Operating System
2020-11-20T19:32:33.0828375Z Microsoft Windows Server 2019
2020-11-20T19:32:33.0828593Z 10.0.17763
2020-11-20T19:32:33.0828796Z Datacenter
2020-11-20T19:32:33.0828984Z ##[endgroup]
2020-11-20T19:32:33.0829210Z ##[group]Virtual Environment
2020-11-20T19:32:33.0829452Z Environment: windows-2019
2020-11-20T19:32:33.0829696Z Version: 20201116.1
2020-11-20T19:32:33.0830062Z Included Software: https://github.com/actions/virtual-environments/blob/win19/20201116.1/images/win/Windows2019-Readme.md
2020-11-20T19:32:33.0830714Z ##[endgroup]

When I build the same codebase in the same configuration on my personal machine with Visual Studio 16.7.7 and .NET Framework 4.8.0.03761 the build succeeds.

Developer technologies | .NET | .NET Runtime
Developer technologies | .NET | Other
{count} vote

Accepted answer
  1. Joe Manke 1,091 Reputation points
    2020-11-20T23:27:39+00:00
    5 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-11-20T22:54:33.057+00:00

    The product group for Azure DevOps actively monitors questions over at
    https://developercommunity.visualstudio.com/spaces/21/index.html

    --please don't forget to Accept as answer if the reply is helpful--

    2 people found this answer helpful.

  2. Johnny Marcos 1 Reputation point
    2022-09-20T17:01:35.273+00:00

    243122-image.png

    Funciono con agregando en versión de nuget para instalar.

    5.8.0

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.