PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
44.59k stars 7.21k forks source link

Cannot uninstall dotnet tool #20266

Open lonix1 opened 1 year ago

lonix1 commented 1 year ago

Prerequisites

Steps to reproduce

One cannot uninstall the dotnet tool.

Repro in a docker container, to prove the problem is not my environment:

$ docker run -it --rm mcr.microsoft.com/dotnet/sdk

$ mkdir /test
$ cd /test

$ dotnet new tool-manifest
The template "Dotnet local tool manifest file" was created successfully.

$ dotnet tool install --local PowerShell
You can invoke the tool from this directory using the following commands: 'dotnet tool run pwsh' or 'dotnet pwsh'.
Tool 'powershell' (version '7.3.6') was successfully installed. Entry is added to the manifest file /test/.config/dotnet-tools.json.

$ dotnet tool restore
Tool 'powershell' (version '7.3.6') was restored. Available commands: pwsh
Restore was successful.

$ which pwsh
/usr/bin/pwsh

$ dotnet tool uninstall --local PowerShell
Tool 'powershell' was successfully uninstalled and removed from manifest file /test/.config/dotnet-tools.json.

$ which pwsh
/usr/bin/pwsh                      # <------ still installed

Expected behavior

The tool to be uninstalled.

Actual behavior

The tool is not uninstalled.

Error details

n/a

Environment data

n/a (run in docker container)

Visuals

No response

237dmitry commented 1 year ago

/usr/bin/pwsh

Stale symlink?

lonix1 commented 1 year ago

It is a symlink, but not stale: it links to /usr/share/powershell/pwsh, which is still there. Actually the entire /usr/share/powershell/ directory is still there, and pwsh itself can be run successfully.

So it's not uninstalling at all.

SteveL-MSFT commented 12 months ago

cc @adityapatwardhan

rhubarb-geek-nz commented 10 months ago

It is a symlink, but not stale: it links to /usr/share/powershell/pwsh, which is still there. Actually the entire /usr/share/powershell/ directory is still there, and pwsh itself can be run successfully.

So it's not uninstalling at all.

That is not where I would expect a dotnet tool is installed, normally it goes under $HOME/.dotnet/tools. That looks more like the full PowerShell package.

% docker run -it --rm mcr.microsoft.com/dotnet/sdk
Unable to find image 'mcr.microsoft.com/dotnet/sdk:latest' locally
latest: Pulling from dotnet/sdk
31ce7ceb6d44: Pull complete 
d6e4a8c13b9e: Pull complete 
09b93266de2f: Pull complete 
fe5e6284a6e0: Pull complete 
2b7d7902c3a4: Pull complete 
7b6684fcf4b9: Pull complete 
d4eae3370528: Pull complete 
91e7b530590e: Pull complete 
7a69c94a1532: Pull complete 
Digest: sha256:239eb99884b49bac13f4ff5935e118654f87b67d6e31bc842c7cd5a6c46fcc4f
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:latest
root@3d57a1a3a021:/# which pwsh
/usr/bin/pwsh
root@3d57a1a3a021:/# ls -ld /usr/bin/pwsh
lrwxrwxrwx 1 root root 26 Nov 14 14:57 /usr/bin/pwsh -> /usr/share/powershell/pwsh
root@3d57a1a3a021:/# 

So it is already there before you install the tool, it is already part of the image