.NET Core SDK 5.0.100 的 Nuget 恢复失败
Nuget restore fails with .NET Core SDK 5.0.100
我刚刚更新了一个使用 net50
的解决方案,它在本地构建,但不在 Azure 管道中构建。如何指定能够构建 net50
个项目的 Azure 管道代理?
管道在 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'
好像还没有更新镜像,16.8还没有。请检查此 GitHub issue:
We keep the visual studio version always up to date. However, deploying images can sometimes take a week(or two).
使用 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
.
我刚刚更新了一个使用 net50
的解决方案,它在本地构建,但不在 Azure 管道中构建。如何指定能够构建 net50
个项目的 Azure 管道代理?
管道在 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'
好像还没有更新镜像,16.8还没有。请检查此 GitHub issue:
We keep the visual studio version always up to date. However, deploying images can sometimes take a week(or two).
使用 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 anet48
project - which happened to be included in this pipeline's solution - failed undernetcoreapp3.1
, but appears to work undernet50
.