Azure Pipelines Error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0

NET6 Azure DevOps

I’ve just finished doing a bunch of work with same ASP.NET Core web applications and Blazor WebAssembly Applications targeting .NET 5.0. Now, that .NET 6.0 is GA, .NET 5.0 will reach end of support in May 2022.

This was all very straightforward, except when building my App in Azure Pipelines, where I got the following error:

Error NETSDK1045: 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.

This tells me that .NET 6.0 is not yet installed on the latest hosted build agents in Azure Pipelines, and I’ll have to arrange for that myself. Fortunately, this is pretty simple, and the following task needs to be added to the pipeline before you run any dotnet command:

- task: UseDotNet@2
  displayName: 'Use dotnet 6'
  inputs:
    version: '6.0.x'

This will pull down the latest 6.0 version of dotnet, and use that when building.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.