In my solution I have project targetting .netstandard 2.0, as we cannot have test case project targeting the same platform, I am using .netcore 3.1 unit test project, even after I updated the build pipeline to use .net 3.1, I am facing below issue at restore nuget step in build pipeline.
##[error]The nuget command failed with exit code(1) and error(C:\Program Files (x86)\Microsoft Visual Studio\2017\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(112,5): error : The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\1\s\src\SampleProject\test\UnitTest\UnitTest.csproj])
##[error]Packages failed to restore
Note : https://www.hanselman.com/blog/AzureDevOpsContinuousBuildDeployTestWithASPNETCore22PreviewInOneHour.aspx is the link I followed to troubleshoot this issue but still facing the same error.