【问题标题】:Nuget Error NU1605 in Azure Pipeline deployment for project referenceAzure Pipeline 部署中的 Nuget 错误 NU1605 以供项目参考
【发布时间】:2020-08-19 02:19:48
【问题描述】:

我一直在尝试为 Azure Functions 项目更新我的业务逻辑层 dll。当我构建/恢复 nuget 包时,我的本地计算机上的一切似乎都运行良好,但是当我使用我们的 IAC 将其推送到通过 Azure Pipelines 进行部署时,它会失败并显示 nuget 代码 NU1605。

基本上我在多个项目中有多个功能,所以结构看起来像这样:

Function1 -Reference-> Common(用于 DI)
Function2 - 参考 -> Common
Function1 -Reference-> BLLDLL
Function2 -Reference-> BLLDLL
Common -Reference-> BLLDLL

这就是失败时控制台中的样子

   (Restore target) -> 

     /home/vsts/work/1/s/Function1.csproj : error NU1605: Detected package downgrade: BusinessLogic from 1.19 to 1.17. Reference the package directly from the project to select a different version. 
   /home/vsts/work/1/s/Function1.csproj : error NU1605:  Function1 -> Common -> BusinessLogic (>= 1.19) 
   /home/vsts/work/1/s/Function1.csproj : error NU1605:  Function1  -> BusinessLogic (>= 1.17)

Function1 已更新到 1.19,所以我不确定它在这里抱怨什么。 Common 确实恢复正常,我什至尝试拆分 Common 来恢复并首先在我们的 YAML 中构建,认为这是因为项目 DLL 尚未构建,但没有任何作用。我确定我遗漏了一些小东西,我们的其他解决方案具有相同的结构并且没有失败。如果需要,我很乐意尝试提供更多信息,但我很难过。

【问题讨论】:

    标签: azure-devops azure-functions azure-pipelines nuget-package-restore


    【解决方案1】:

    Azure Pipeline 部署中的 Nuget 错误 NU1605 供项目参考

    正如错误信息所示:

    Function1.csproj : error NU1605:  Function1 -> Common -> BusinessLogic (>= 1.19) 
    Function1.csproj : error NU1605:  Function1  -> BusinessLogic (>= 1.17)
    

    所以,项目Function1.csproj直接引用了低版本nuget包BusinessLogic (>= 1.17),但间接引用了高版本nuget包BusinessLogic (>= 1.19)。这将导致错误NU1605: Detected package downgrade。

    要解决这个问题,我们需要在本地将项目Function1.csproj的直接引用BusinessLogic (>= 1.17)更新为版本1.19,然后将此更改提交到Azure repo。

    【讨论】:

    • 您好,谢谢您的回复,我在 Function1 中确实引用了 1.19,但似乎仍然认为我将其设置为 1.17。 编辑:我在 Function1 中有 3 个引用,一个对 Sdk.Functions 的包引用,一个对 BusinessLogic v1.19 的包引用和一个对 Common.csproj 的项目引用
    【解决方案2】:

    我想通了,在我们的解决方案重组之前,我们的 csproj 文件的旧版本不知何故回到了我们源代码的主分支并被 YAML 拾取。

    【讨论】:

      猜你喜欢
      • 2020-11-14
      • 2018-07-09
      • 1970-01-01
      • 2022-07-26
      • 2020-07-06
      • 1970-01-01
      • 1970-01-01
      • 2018-05-21
      相关资源
      最近更新 更多