【问题标题】:ADO Pipeline - Restore Packages for DotNet 6ADO 管道 - 为 DotNet 6 恢复包
【发布时间】:2022-01-15 01:03:21
【问题描述】:

我有一个 dotnet 解决方案,其中包含测试和库项目 + 一个 Azure Functions 项目。

我已将所有 nuget 包更新为最新版本,并将 Azure Functions 项目设置为

<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>

在 VS2022 中,现在一切正常,所有测试都通过了。

但是,当我的 Azure DevOps 构建管道运行其 nuget restore 任务时,我收到很多关于与 net60 不兼容的各种包的错误,例如:

Package Serilog.Extensions.Hosting 4.1.2 is not compatible with net60 (.NETFramework,Version=v6.0).

构建管道的恢复任务的yaml是:

- task: NuGetCommand@2
  displayName: Restore
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'

构建管道设置为运行:

jobs:
job: Build
displayName: Build
pool:
  vmImage: 'windows-latest'

谁能解释为什么该解决方案可以在我的笔记本电脑上恢复和构建正常但在管道中失败?

【问题讨论】:

    标签: .net azure-devops msbuild nuget


    【解决方案1】:

    代理上嵌入的默认 nuget 版本不应支持您的项目。 我建议您在进行 nuget 还原之前,将“NuGet 工具安装程序”任务与您在计算机上使用的版本一起使用。

    【讨论】:

      猜你喜欢
      • 2016-08-15
      • 1970-01-01
      • 1970-01-01
      • 2020-12-02
      • 1970-01-01
      • 2017-12-05
      • 1970-01-01
      • 2022-10-21
      • 1970-01-01
      相关资源
      最近更新 更多