我的构建在本地运行良好(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/