How can i resolve Azure Pipeline Build Error?

Viewed 43

I am running build pipeline for my REST API. I have upgraded my version to .net6.0. Below is my error:

The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0.

Below is a part of my yaml for api:

 - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: true
        zipAfterPublish: true
        arguments: '--output $(build.artifactstagingdirectory)/api'

Kindly help me and let me know in case of any more details:

1 Answers

This issue is resolved. I had to add new step in my yaml and tell it to use/set the target framework .net6.0.x

- task: UseDotNet@2
      displayName: Use .NET 6.0
      inputs:
          packageType: 'sdk'
          version: '6.0.x'
          installationPath: $(Agent.ToolsDirectory)/dotnet

Adding the above step in my yaml resolved both the errors.

Thank You :)

Related