Azure Pipelines 托管代理已更新,现在包含 .Net 5.x SDK/运行时以及较旧的 .Net Core

问题描述 投票:0回答:1

最近将我的应用程序升级到.NET 8.0。

Azure 管道中出现以下错误。

##[error]Error: The process '/opt/hostedtoolcache/dotnet/dotnet' failed with exit code 2
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. 

##[error]Dotnet command failed with non-zero exit code on the following projects : [ '' ]

我已经将任务添加到 .NET SDK 8.0.302 和 .NET Core 运行时 8.0.6 的 YAML 中,该任务成功,然后遇到此错误。管道出了什么问题?

YAML:

steps:
          - task: UseDotNet@2
            displayName: 'Install .NET Core runtime'
            inputs:
              packageType: "runtime"
              version: "8.0.6"
          - task: UseDotNet@2
            displayName: "Using DotNet@2"
            inputs:
              packageType: "sdk"
              version: "8.0.302"
          - task: DotNetCoreCLI@2
            displayName: "Install dotnet format"
            inputs:
              command: "custom"
              custom: "tool"
              arguments: "update -g dotnet-format"
          - task: DotNetCoreCLI@2
            displayName: "Lint dotnet"
            inputs:
              command: "custom"
              custom: "format"
              arguments: "--verify-no-changes --verbosity diagnostic"
              workingDirectory: backend

详细错误信息如下所示: Azure 管道错误

azure asp.net-core .net-core azure-devops azure-pipelines
1个回答
0
投票

在迁移到 CI 之前,构建是否在本地进行了测试?我建议查看 .NET 8 的重大更改并确保兼容性。

https://learn.microsoft.com/en-us/dotnet/core/compatibility/8.0

© www.soinside.com 2019 - 2024. All rights reserved.