sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Detect and suggest updating dotnet global tools

Open kzu opened this issue 1 year ago • 1 comments

Most CLI tools nowadays notify users of updates that can be installed (i.e. ngrok, gh cli, etc.). In many cases, they can update themselves.

This is currently impossible to achieve from within dotnet global tools, since the tool files are locked while it's running, and therefore a dotnet update command fails since it attempts to delete the version being replaced.

Since the dotnet install tool can know the originating source for a tool, and there is a built-in API in nuget to check for updates (see this example of how to show pending updates for a global tool, it should be in principle possible to remember the source feed location and check for updates periodically (before, during or after) when the tool is used. I currently run this concurrently in the background while the tool runs and show the updates afterwards.

Ideally, dotnet itself would check for updates and offer to update tools.

/cc @baronfel

kzu avatar Aug 21 '24 18:08 kzu

A new option as of .NET 10 preview 6 is to invoke tools via the dnx or dotnet tool exec commands for npx-style download+install. This will always use the latest version by default (unless you specify an exact version) and so will float users by default.

baronfel avatar Jun 19 '25 22:06 baronfel

Hehe, 7 years in the making: https://github.com/ErikEJ/dnx 😅

kzu avatar Jun 29 '25 04:06 kzu