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

泄露秘密 提交于 2020-05-10 04:09:14

问题


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?


回答1:


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

Hope this helps.




回答2:


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.




回答3:


If you use the image 'windows-latest' you should be able to use dotnet commands. I changed it from 'ubuntu-latest' to 'windows-latest' and it worked fine.



来源:https://stackoverflow.com/questions/59241957/net-core-3-1-not-yet-supported-in-azure-pipelines-hosted-agents-getting-netsdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!