Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet tool install/uninstall should support post-install/uninstall action

See original GitHub issue

In dotnet templates, you can run a set of specific, standardized actions or even a custom script after a template is executed. It’d be great if the dotnet tool install supported something similar as part of the distributed nuget package.

A good use case for this is that we have a dotnet global tool which uses a specific set of templates. It supports a command to install/update the templates, but it means that any user of the CLI needs to either have already installed the template via the dotnet cli or installed the global tool and run the update/install command.

Furthermore, when troubleshooting our global tool, I think a user would be confused if they ran a dotnet tool uninstall and there were still leftover artifacts (even if those artifacts are just dependencies).

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview5-011568
 Commit:    b487ff10aa

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\

Host (useful for support):
  Version: 3.0.0-preview5-27626-15
  Commit:  61f30f5a23

.NET Core SDKs installed:
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.302 [C:\Program Files\dotnet\sdk]
  2.1.400 [C:\Program Files\dotnet\sdk]
  2.1.401 [C:\Program Files\dotnet\sdk]
  2.1.402 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.2.104 [C:\Program Files\dotnet\sdk]
  3.0.100-preview5-011568 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspN                                                                       etCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.All]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspN                                                                       etCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNe                                                                       tCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [C:\Program Files\dotnet\shar                                                                       ed\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared                                                                       \Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore                                                                       .App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.                                                                       App]
  Microsoft.NETCore.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\shared\                                                                       Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\                                                                       shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

tmdscommented, Jul 9, 2020

Distro packages also have such hooks, and they are very useful.

For example, before uninstall you can remove some files the tool created.

Some ideas on implementation.

It could be implemented by invoking the application with a specific set of arguments. For example the first one could be the literal “[tool-hook]” and second one indicating the event.

Some interesting events: postinstall, preupdate (against previous), postupdate (against new), preuninstall. May also be interesting: update. When update is requested, but no new version is available. This allows the application to check for new resources, like templates.

The tools should be able to indicate they support such [tool-hook] events, to avoid invoking this on applications which are not tool hook aware.

The application return value should return 0 on success. Also for unknown event names, the application should return 0 (or another specific value) to indicate the event is not known. This allows to define additional events.

Alxandrcommented, Feb 2, 2020

Another use case, git hooks. Husky for node is brilliant in that you only need to add it to your dev dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet tool uninstall command - .NET CLI
The dotnet tool uninstall command provides a way for you to uninstall .NET tools from your machine. To use the command, you specify...
Read more >
Batch file is not executing before application uninstalled ...
I'm not doing real fancy stuff in my batch file either. The installation of the Excel addin works fine (which is the premise...
Read more >
Frequently Asked Questions about installation errors
If you cannot uninstall the software, you can use Microsoft's Windows Installer Cleanup Utility to remove the previous version from the system.
Read more >
NI Package Management Idea Exchange - NI Community
To do this, you must first uninstall the package so you can select the version you want from the Packages screen. (Installed packages...
Read more >
Uninstalling · Continuum XFP Developer Guide
Uninstalling XFP will remove the module from your installation. This is a destructive action and cannot be undone. These uninstallation instructions only ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found