在 DevOps 管道中检查过时的 nuget 包

问题描述

我正在尝试在我们的构建管道之一中检查过时的包。更复杂的是,我们使用来自 nuget.org 的包以及来自我们自己的存储库(DevOps 工件提要)的包。这些源在 nuget.config 中配置。包还原任务成功,没有任何问题:

- task: NuGetCommand@2
  displayName: Restore Nuget Packages
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    FeedsToUse: 'config'
    nugetConfigPath: 'nuget.config'

在这一步之后,我们安装 dotnet-outdated-tool:

- task: DotNetCoreCLI@2
  displayName: install dotnet-outdated-tool
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'install dotnet-outdated-tool -g --ignore-Failed-sources'

请注意,我们已经在此处添加了 --ignore-Failed-sources 选项,否则该工具将无法正确安装,因为它会抱怨无法访问我们的提要,但我们可以通过添加 --ignore-Failed - 来源。

关于我的问题,下一步,也是最重要的一步,是我们尝试运行过时的工具来检查过时的包:

- task: DotNetCoreCLI@2
  displayName: Check outdated packages
  inputs:
    command: 'custom'
    custom: 'outdated'
    arguments: '$(pathTosolution)'
  env:
      SYstem_ACCEsstOKEN: $(System.Accesstoken)

对于来自 nuget.org 的软件包,这似乎工作正常:

  Microsoft.Extensions.DependencyInjection  5.0.0  -> 5.0.1 
  Microsoft.NET.Test.Sdk                    16.7.1 -> 16.9.1
  MSTest.TestAdapter                        2.1.1  -> 2.2.1 

对于来自我们自己的提要的包,它无法解析最新版本:

Some.Internal.Component            1.22.0        ->     

它还提到:

Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?

所以很明显它无法连接到我们的内部 nuget 提要。 尝试通过将系统访问令牌添加到任务来解决它:SYstem_ACCEsstOKEN: $(System.Accesstoken) 但不幸的是,这并不能解决任何问题。我错过了什么????

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)