gpt4 book ai didi

azure-devops - .NET Core SDK 5.0.100 导致 Nuget 还原失败

转载 作者:行者123 更新时间:2023-12-03 21:09:45 25 4
gpt4 key购买 nike

我刚刚更新了一个解决方案来使用 net50 ,它在本地构建,但不在 Azure 管道中构建。如何指定能够构建的 Azure 管道代理 net50项目?

管道在 nuget restore 上失败步骤与以下错误:

The nuget command failed with exit code(1) and error([***].csproj : error : 
Version 5.0.100 of the .NET Core SDK requires at least version 16.8.0 of MSBuild.
The current available version of MSBuild is 16.7.0.37604.
Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.
我的管道 yaml 包括:
trigger:
- master

pool:
vmImage: 'windows-latest'

variables:
buildConfiguration: 'Debug'

steps:

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 5.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: NuGetCommand@2
displayName: 'nuget restore'
inputs:
restoreSolution: '**/*.sln'
feedsToUse: config
nugetConfigPath: 'NuGet.config'

最佳答案

使用 NuGetCommand@2 的解决方法步骤是使用DotNetCoreCLI@2步骤代替。如果您正在构建遗留(非 SDK)项目,这可能不可行。
我的 YAML 现在是:

trigger:
- master

pool:
vmImage: 'windows-latest'

variables:
buildConfiguration: 'Debug'

steps:

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 5.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
感谢@Krzysztof 为我指明了正确的方向。

FWIW, and this is from memory, using DotNetCoreCLI@2 for a net48 project - which happened to be included in this pipeline's solution - failed under netcoreapp3.1, but appears to work under net50.

关于azure-devops - .NET Core SDK 5.0.100 导致 Nuget 还原失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64794372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com