简体   繁体   中英

Problem with "nuget restore" with some lib's in build azure Pipeline

I am using netcoreapp3.1 and everything works with the command dotnet restore and dotnet build, but in the build pipeline, the command used is nuget restore, and this causes the following errors:

 Package Microsoft.AspNetCore.JsonPatch 3.1.1 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.AspNetCore.JsonPatch 3.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.Logging.Abstractions 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.Logging.Abstractions 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.DependencyInjection.Abstractions 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Extensions.DependencyInjection.Abstractions 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    One or more packages are incompatible with .NETCoreApp,Version=v3.1.

In my scenario, I had to install NuGet 5.4.0 (released with .NET Core 3.1) to fix this

If using YAML templates in Azure DevOps you can add this task:

- task: NuGetToolInstaller@1
  inputs:
    versionSpec: '5.4.0'

我使用了错误的代理规范,正确的是 windows-2019 我使用的是 windows-2017

this solved

- task: NuGetToolInstaller@1
  inputs:
    versionSpec: '5.x'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM