Skip to content

A simple command line utility to find out / check, whether any of installed .NET Core global tools are outdated

License

Notifications You must be signed in to change notification settings

rychlym/dotnet-tools-outdated

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet-tools-outdated

NuGet NuGet

News

Since the dotnet-tools-outdated ver. 0.7.0 is supported checking of the locally instaled packages. To see more, please go the chapter bellow. There are also several breaking changes and fixes, especially regarding the JSON and XML output. There are also small updates of the options. I will provide a list of the changes at the NuGet package web site.

Overview

It might be handy to find out whether newer versions of the .NET global tools currently installed on your machine is available. However, the .NET command-line tools do not provide a built-in way for you to report on outdated NuGet packages of the global tools.

dotnet-tools-outdated is a global tool, that allows you to quickly report on any outdated global tools currently installed on your machine.

Detail

The out-of-box command for listing all the global tools is typed as follows:

dotnet tool list -g
Package Id                              Version          Commands
------------------------------------------------------------------------------
apiport                                 2.8.14           ApiPort
dotnet-tools-outdated                   0.7.0            dotnet-tools-outdated
dotnet-try                              1.0.19553.4      dotnet-try
project2015to2017.migrate2019.tool      4.1.3            dotnet-migrate-2019
try-convert                             0.7.210903       try-convert
upgrade-assistant                       0.2.212405       upgrade-assistant

It greatly tells about the installed version. Hovewer, it does not inform if a package is outdated.

The dotnet-tools-outdated provides such info just by typing:

dotnet-tools-outdated
Package Id                         Current     Available
---------------------------------------------------------
dotnet-tools-outdated              0.5.2       0.7.0
dotnet-try                         1.0.19553.4
try-convert                        0.7.210903  0.9.232202
upgrade-assistant                  0.2.212405  0.3.255803

It lists just the packages which are outdated in a meaning, that it can be updated to a higher version or are obsolete (marked as unlisted - e.g. dotnet-try above). Or the output is just empty, if there is no outdated global tool.

Locally installed .NET command-line tools

In a case of running the dotnet-tools-outdated from a directory covered by localy installed .NET tools, the locally installed tools are also checked. If the local tools are outdated, the console shows an additional and slightly different table preceding the table with the globally installed tools.

dotnet-tools-outdated -s

(the -s option shows one statistics row at the end)

Package Id            Current Available Manifest
-----------------------------------------------------------------------------------------------------
dotnet-tools-outdated 0.3.0   0.7.0     C:\Users\mr\source\repos\my\console\.config\dotnet-tools.json
dotnetsay             2.0.1   2.1.7     C:\Users\mr\source\repos\.config\dotnet-tools.json

Package Id            Current Available
---------------------------------------
dotnet-tools-outdated 0.6.1   0.7.0

2 local and 3 global packages available. Found 3 outdated packages.

The table of locally installed tools is recognizable by the additional Manifest table column.
The locally installed tools are always tight with the .config/dotnet-tools.json manifest file somewhere in the current directory structure - to get to more detail, please check the .NET Local Tools links in the Useful links

Installation

Download and install the .NET 6 SDK or .NET 8 SDK currently in LTS (Long Term Support) or a newer (or a non LTS between). Once installed, run the following command:

dotnet tool install -g dotnet-tools-outdated

This will install the dotnet-tools-outdated as the global .NET tool.

If you already have a previous version of dotnet-tools-outdated installed, you can uptdate to the latest version using the following command:

dotnet tool update -g dotnet-tools-outdated

Supposing rarelly, but in case of the older .NET Core SDK (up to .NET Core 2.1), please install/update to the version lesser than 0.6.2. e.g:

dotnet tool install -g --version 0.5.2 dotnet-tools-outdated

Usage

Help

dotnet-tools-outdated -h
dotnet-tools-outdated

Checks whether any of installed .NET command-line tools is outdated.

Usage: dotnet-tools-outdated [options]

Options:
  --version                Show version information.
  -?|-h|--help             Show help information.
  -n|--name                Check (and show) only one particular package
  -f|--format              Output format. Valid values are xml, json, or table. (Default: table)
  --outPkgRegardlessState  Otput the both up-to-date/outdated state packages for the json and xml format. (The table
                           format can show only the outdated packages)
  -ni|--noIndent           No indenttation (for the json and xml format)
  -o|--output              Output file path. (Default: stdout)
  --utf8                   Output with UTF-8 instead of the system default encoding. (no bom)
  -pre|--prerelease        Check also pre-released versions
  -s|--showStat            Show statistics info row (sums of available and outdated packages)
  -gt|--globalToolsPath    Use custom location of the globally installed .NET tools

Outdated tools

Notes:

  • the output is empty in case of all the installed packages up-to date (the -s option can at least provide an info if any packages have been checked, if a need).
  • in case of unlisted (deprecated) NuGet package, it does not have the "Available" version column value (e.g. dotnet-try below)
dotnet-tools-outdated
Package Id                         Current     Available
---------------------------------------------------------
dotnet-tools-outdated              0.5.2       0.7.0
dotnet-try                         1.0.19553.4
try-convert                        0.7.210903  0.9.232202
upgrade-assistant                  0.2.212405  0.3.255803

Output to JSON/ XML

Notes:

  • it shows little more info about installed tools
  • it allows to show also installed packages, which are up-to-date (if the --outPkgRegardlessState option is specified)
    • isOutdated informs whether the installed golbal tool is/is not outdated
    • becomeUnlisted informs the installed golbal tool is/is not set as deprecated, alias unlisted at the NuGet repo)
  • in case of unlisted (deprecated) NuGet package, it does not have the "Available" version column value
  • the ver at the root level is the version of the dotnet-tools-outdated itself

Example of a JSON output

dotnet-tools-outdated -f json --outPkgRegardlessState
{
  "ver": "0.7.0",
  "outPkgRegardlessState": true,
  "dotnet-tools-outdated": [
    {
      "packageName": "dotnet-tools-outdated",
      "isOutdated": true,
      "currentVer": "0.3.0",
      "availableVer": "0.7.0",
      "becomeUnlisted": false,
      "directory": "C:\\Users\\user\\source\\repos\\my\\console",
      "localManifestRefInfo": {
        "filePath": "C:\\Users\\user\\source\\repos\\my\\console\\.config\\dotnet-tools.json",
        "version": 1,
        "isRoot": false
      }
    },
    {
      "packageName": "dotnetsay",
      "isOutdated": true,
      "currentVer": "2.0.1",
      "availableVer": "2.1.7",
      "becomeUnlisted": false,
      "directory": "C:\\Users\\user\\source\\repos",
      "localManifestRefInfo": {
        "filePath": "C:\\Users\\user\\source\\repos\\.config\\dotnet-tools.json",
        "version": 1,
        "isRoot": true
      }
    },
    {
      "packageName": "dotnet-tools-outdated",
      "isOutdated": true,
      "currentVer": "0.6.1",
      "availableVer": "0.7.0",
      "becomeUnlisted": false,
      "directory": "C:\\Users\\user\\.dotnet\\tools\\.store\\dotnet-tools-outdated"
    },
    {
      "packageName": "try-convert",
      "isOutdated": false,
      "currentVer": "0.9.232202",
      "availableVer": "0.9.232202",
      "becomeUnlisted": false,
      "directory": "C:\\Users\\user\\.dotnet\\tools\\.store\\try-convert"
    },
    {
      "packageName": "upgrade-assistant",
      "isOutdated": false,
      "currentVer": "0.5.568",
      "availableVer": "0.5.568",
      "becomeUnlisted": false,
      "directory": "C:\\Users\\user\\.dotnet\\tools\\.store\\upgrade-assistant"
    }
  ]
}

Example of a XML output

dotnet-tools-outdated -f xml
<?xml version="1.0" encoding="utf-8"?>
<dotnet-tools-outdated version="0.7.0" outPkgRegardlessState="false">
  <package name="dotnet-tools-outdated" outdated="true">
    <currentVer>0.3.0</currentVer>
    <availableVer>0.7.0</availableVer>
    <becomeUnlisted>false</becomeUnlisted>
    <directory>C:\Users\mr\source\repos\my\console</directory>
    <localManifestRefInfo filePath="C:\Users\mr\source\repos\my\console\.config\dotnet-tools.json" isRoot="false" version="1" />
  </package>
  <package name="dotnetsay" outdated="true">
    <currentVer>2.0.1</currentVer>
    <availableVer>2.1.7</availableVer>
    <becomeUnlisted>false</becomeUnlisted>
    <directory>C:\Users\mr\source\repos</directory>
    <localManifestRefInfo filePath="C:\Users\mr\source\repos\.config\dotnet-tools.json" isRoot="true" version="1" />
  </package>
  <package name="dotnet-tools-outdated" outdated="true">
    <currentVer>0.6.1</currentVer>
    <availableVer>0.7.0</availableVer>
    <becomeUnlisted>false</becomeUnlisted>
    <directory>C:\Users\mr\.dotnet\tools\.store\dotnet-tools-outdated</directory>
  </package>
</dotnet-tools-outdated>

Build

git clone https://github.com/rychlmoj/dotnet-tools-outdated
cd dotnet-tools-outdated/src/DotNetToolsOutdated
dotnet pack -c release -o nupkg

Output is located in src/DotNetToolsOutdated/nupkg

Uninstall

dotnet tool uninstall -g dotnet-tools-outdated

Common Release Notes

Since the versions 0.6.0> the dotnet-tools-outdated are going to be ported for the available .NET LTS scheme . (Currently the .NET 6 and .NET 8) This is on behalf of minimizing the size of the package. It is also supposed, folks who using this usually care about the updated versions of the global tools, and don't' need the older version of the .NET SDK.

However if a relly a neeed of environment with an older .NET SDK, then please install the following lower version (There is no functionality change/bug fixings in the current version comparing up to the 0.5.2 version)

  • 0.6.0 - if a need to run under the .NET 3.1 (and no .NET 6> SDK is present.)
  • 0.5.x - if a need to run under the .NET Core 2.1

Useful Links

.NET Global Tools

(Since .NET Core 2.1 SDK)

.NET Local Tools

(Since .NET Core 3.0 SDK)

About

A simple command line utility to find out / check, whether any of installed .NET Core global tools are outdated

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages