将应用程序从 ASP.NET Core 2.2 升级到 ASP.NET Core 3.1 后,Azure DevOps 构建失败

标签 azure azure-devops msbuild asp.net-core-3.1

我的构建在本地运行良好(VSCode、.NET Core 3.1.101),但在 Azure DevOps Pipeline 中运行时失败并显示以下消息。

我的管道被精简到最基本的:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

这会导致此错误消息:

Version 3.1.101 of the .NET Core SDK requires at least version 16.3.0 of MSBuild. The current available version of MSBuild is 15.9.21.664. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

我找不到更改管道运行的 MSBuild 版本的方法,而更改为旧版本的 .NET Core 肯定达不到升级的目的?

有没有办法在 Azure DevOps 上构建 .NET Core 3.1 解决方案?

最佳答案

我没有看到您在任何地方执行 dotnet build 任务,您需要配置版本的 dotnetbuild 任务,

steps:

    - task: UseDotNet@2 
      displayName: ".NET Core 3.1.x"
      inputs:
        version: '3.1.x'
        packageType: sdk
    - script: dotnet build --configuration $(buildConfiguration)
      displayName: 'dotnet build $(buildConfiguration)'

引用此article .

关于将应用程序从 ASP.NET Core 2.2 升级到 ASP.NET Core 3.1 后,Azure DevOps 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60140393/

相关文章:

azure - SQL Azure 弹性池每个数据库的最大 DTU

linux - 我正在尝试为 xbuild 构建一个 msbuild 项目,但它一直失败

msbuild - 如何使用 MSBuild 远程启动/停止服务?

git - 将 Github 存储库与 Azure DevOps 存储库同步

visual-studio - Visual Studio 2017,每个 TFVC 项目有 1 个工作区,还是 1 个工作区中有多个 TFVC 项目?

msbuild - 将 msbuild 参数传递给 dotnet run 命令

Python Azure图: Access Token missing or malformed

azure - 通过 bicep 使用托管身份的 API 连接( keystore 、服务总线和 blob)

Azure BLOB 存储 - 许多事务

azure-devops - GitHttpClient 获取 ref/tag 的提交