You probably need to use UseDotNet task to get the .NET 5.0 downloaded and used in subsequent dotnet build task. See below example:
- task: UseDotNet@2
displayName: 'Install .Net 5 SDK'
inputs:
packageType: 'sdk'
version: '5.0.100'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…