Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Core 3.1 not yet supported in Azure Pipelines hosted agents? Getting NETSDK1045

It's great that .Net Core 3.1 is out, but I'm not sure the Azure Pipelines hosted agents have caught up.

My YAML pipeline specifies:

pool:
  vmImage: 'windows-latest'

and the dotnet restore step does this:

(_CheckForUnsupportedNETCoreVersion target) -> C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(127,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\1\s\StatsNZ.BESt.DataService\StatsNZ.BESt.DataService.csproj]

works fine in .Net Core 3.0.

Are there any work-arounds, or do we have to wait for Azure DevOps to catch up?

like image 771
EdH Avatar asked Dec 09 '19 02:12

EdH


2 Answers

.Net Core 3.1 not yet supported in Azure Pipelines hosted agents?

No, Azure Pipelines hosted agents supports .Net Core 3.1, but the latest .net core 3.1.100 is not currently installed by default in the Azure Pipelines hosted agents.

You could check the Azure Pipelines Hosted Windows 2019 with VS2019 image, the default installed latest version of .net core is 3.0.100.

To use the .net core 3.1, you could add a Use .NET Core task to install the .net core 3.1.100:

enter image description here

enter image description here

Hope this helps.

like image 177
Leo Liu-MSFT Avatar answered Sep 18 '22 18:09

Leo Liu-MSFT


Add a step to install .NET Core SDK before calling dotnet build.

steps:
- task: UseDotNet@2
  displayName: 'Install .NET Core sdk'
  inputs:
    packageType: sdk
    version: 3.1.100
    installationPath: $(Agent.ToolsDirectory)/dotnet

Working and verified with ubuntu-latest.

like image 36
Bernard Vander Beken Avatar answered Sep 22 '22 18:09

Bernard Vander Beken