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.