I am trying to build a .Net 6 application using UseDotNet@2 azure devops task. But the task is failing with below error.
pool:
vmImage: windows-2019
- task: UseDotNet@2
displayName: Use .NET
inputs:
packageType: 'sdk'
version: 6.x
vsVersion: 17.0.x
But same task is able to pull preview version of .Net 6 when I specify IncludePreviewVersions as true.
Has any one faced this issue? Any help would be appreciated!
CodePudding user response:
It is not supported to use .NET 6 on the Windows 2019 image. Probably preview versions are more lenient than releases.
To solve the issue, explicitly select windows-2022 as the version . Of course, if there's no explicit reason to use a Windows based build agent, you can also use an Ubuntu based build agent. If you do not specify an image for a YAML build pipeline, it will use ubuntu-latest by default.
For more information, see this GitHub issue


