dotnet.exe CLI - 检查是否有更新的 nuget 版本可用

问题描述

我开发了一个(非公开的)nuget 工具。安装非常简单:

dotnet tool install dotnet-mytoolname -g

我的同事也会通过命令安装这些工具。

将来我将发布新版本的 dotnet-mytoolname。消费者将使用 dotnet.exe 轻松更新。

现在我的问题: 如果开发人员运行该工具的过时版本,那么我会在控制台输出提示它(类似于“有新版本可用”)。 如果有新版本可用,我如何使用 dotnet.exe 检查?

下面的命令可以执行此操作,但仅适用于 nuget.org。但是我们的 nuget-tool 不是托管在 nuget.org 上,而是托管在一个私有的 azure-devops 服务器上。

dotnet tools search dotnet-mytoolname

nuget-tool dotnet-mytoolname一个 C# 控制台项目。

如果 azure-devops 上有更新的版本,你有什么想法我可以如何检查该项目吗?

解决方法

谢谢DavidG。发布您的建议作为答案以帮助其他社区成员。

安装 dotnet 过时的应用程序将帮助您解决问题 安装 .Net core 并运行以下命令

dotnet tool install --global dotnet-outdated-tool

使用方法如下

Usage: dotnet outdated [options] <Path>

Arguments:
  Path                                       The path to a .sln,.csproj or .fsproj file,or to a directory containing a .NET Core solution/project. If none is specified,the current directory will be used.

Options:
  --version                                  Show version information
  -?|-h|--help                               Show help information
  -i|--include-auto-references               Specifies whether to include auto-referenced packages.
  -pre|--pre-release <PRERELEASE>            Specifies whether to look for pre-release versions of packages. Possible values: Auto (default),Always or Never.
  -vl|--version-lock <VERSION_LOCK>          Specifies whether the package should be locked to the current Major or Minor version. Possible values: None (default),Major or Minor.
  -t|--transitive                            Specifies whether it should detect transitive dependencies.
  -td|--transitive-depth <TRANSITIVE_DEPTH>  Defines how many levels deep transitive dependencies should be analyzed. Integer value (default = 1)
  -u|--upgrade[:<TYPE>]                      Specifies whether outdated packages should be upgraded. Possible values for <TYPE> is Auto (default) or Prompt.
  -f|--fail-on-updates                       Specifies whether it should return a non-zero exit code when updates are found.
  -inc|--include <FILTER_INCLUDE>            Specifies to only look at packages where the name contains the provided string. Culture and case insensitive. If provided multiple times,a single match is enough to include a package.
  -exc|--exclude <FILTER_EXCLUDE>            Specifies to only look at packages where the name does not contain the provided string. Culture and case insensitive. If provided multiple times,a single match is enough to exclude a package.
  -o|--output <OUTPUT_FILENAME>              Specifies the filename for a generated report. (Use the -of|--output-format option to specify the format. JSON by default.)
  -of|--output-format <OUTPUT_FILE_FORMAT>   Specifies the output format for the generated report. Possible values: json (default) or csv.
  -ot|--older-than <NUMBER_OF_DAYS>          Only include package versions that are older than the specified number of days.

查看此 link,它将为您提供有关 dotnet 过时软件包的完整信息。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...