小编DJ *_*ijk的帖子

检查 DevOps 管道中过时的 nuget 包

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

- task: NuGetCommand@2
  displayName: Restore Nuget Packages
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'config'
    nugetConfigPath: 'nuget.config'
Run Code Online (Sandbox Code Playgroud)

在此步骤之后,我们安装 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'
Run Code Online (Sandbox Code Playgroud)

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

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

- task: DotNetCoreCLI@2
  displayName: Check outdated packages
  inputs:
    command: 'custom'
    custom: 'outdated'
    arguments: '$(pathTosolution)'
  env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)
Run Code Online (Sandbox Code Playgroud)

对于 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 
Run Code Online (Sandbox Code Playgroud)

对于我们自己的源中的包,它无法解析最新版本:

Some.Internal.Component …
Run Code Online (Sandbox Code Playgroud)

c# nuget build-pipeline devops

6
推荐指数
1
解决办法
959
查看次数

标签 统计

build-pipeline ×1

c# ×1

devops ×1

nuget ×1