【问题标题】:dotnet.exe CLI - Check if a newer nuget version is availabledotnet.exe CLI - 检查是否有更新的 nuget 版本可用
【发布时间】:2021-09-14 07:54:54
【问题描述】:

我开发了一个(非公开的)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 上有更新的版本可用,您有什么想法可以在该项目中检查吗?

【问题讨论】:

标签: c# .net azure-devops nuget dotnet-cli


【解决方案1】:

谢谢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 过时软件包的完整信息。

【讨论】:

猜你喜欢
  • 2012-09-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-02
  • 1970-01-01
  • 2019-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多