dotnet --info not working: Uninstalling dotnet versions documentation seems incomplete
It is straight forward, but at least in my case, the uninstall instructions do not work. Here is what i did:
I had the 6.0 SDK installed, as well as 3.1. I used the uninstall tool like so:
sudo ./dotnet-core-uninstall remove --sdk 3.1.416
I thought everything was fine, because the tool showed only v6.0 remaining:
billd@MacBeth dotnet-core-uninstall % ./dotnet-core-uninstall list
This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are:
.NET Core SDKs:
6.0.102 (arm64) [Used by Visual Studio for Mac. Specify individually or use —-force to remove]
6.0.101 (arm64)
6.0.100 (arm64)
.NET Core Runtimes:
6.0.2 (arm64) [Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove]
6.0.2 (x64)
6.0.1 (arm64)
6.0.1 (x64)
6.0.0 (arm64)
6.0.0 (x64)
billd@MacBeth dotnet-core-uninstall %
But now I noticed that the dotnet executable disagrees with the uninstall tool about the versions - it shows no SDKs and the 3.1 runtime!
billd@MacBeth dotnet-core-uninstall % dotnet --list-sdks
billd@MacBeth dotnet-core-uninstall % dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
billd@MacBeth dotnet-core-uninstall % dotnet --info
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Host (useful for support):
Version: 3.1.22
Commit: 35fa579a30
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
billd@MacBeth dotnet-core-uninstall %
So i went back to the documentation and tried the manual steps - https://docs.microsoft.com/en-us/dotnet/core/install/remove-runtime-sdk-versions?pivots=os-macos#uninstall-net - but I didn't find any remnants of 3.1.
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/sdk
6.0.100 6.0.101 6.0.102
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/shared/Microsoft.NETCore.App
6.0.0 6.0.1 6.0.2
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App
6.0.0 6.0.1 6.0.2
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/shared/Microsoft.AspNetCore.All
ls: /usr/local/share/dotnet/shared/Microsoft.AspNetCore.All: No such file or directory
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/shared/
Microsoft.AspNetCore.App Microsoft.NETCore.App
billd@MacBeth dotnet-core-uninstall % ls /usr/local/share/dotnet/host/fxr
6.0.0 6.0.1 6.0.2
billd@MacBeth dotnet-core-uninstall %
So there must be something else going on.
I found the section on Arm based paths. There I found some 3.1 parts
billd@MacBeth dotnet-core-uninstall % sudo rm -rf /usr/local/share/dotnet/x64/host/fxr/3.1.22
Password:
billd@MacBeth dotnet-core-uninstall % sudo rm -rf /usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/3.1.22
billd@MacBeth dotnet-core-uninstall % sudo rm -rf /usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App/3.1.22
Issue one: there was no shared/Microsoft.AspNetCore.All folder in the x64 or regular path. The doc says to delete that folder too, but i don't have it.
Issue two: now dotnet in broken.
billd@MacBeth ~ % dotnet --info
A fatal error occurred, the folder [/usr/local/share/dotnet/x64/host/fxr] does not contain any version-numbered child folders
Indeed there aren't any version numbered folders. Why aren't there any? And why does the uninstall tool still see several 6.0 versions installed?
The next step for me is to reinstall the 6.0.2 SDK to see if that resolves the issue. That is the only version I actually need.
Possible Issue three: I also wonder about the /usr/local/share/dotnet/x64/templates directory, as it has a 3.1.23 subfolder. Should i delete that too?
I haven't given explicit corrections for the documentation because I don't know what should change - the documentation, the installer, or the uninstall tool. But I know that taken together, there are some gaps.
Anyway, thanks for listening.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 4efe9b33-ff9f-3b37-e8bd-a34c0a77bd1e
- Version Independent ID: 090b8fbd-39e6-b754-e1da-890b1123f2c4
- Content: Remove the .NET runtime and SDK
- Content Source: docs/core/install/remove-runtime-sdk-versions.md
- Product: dotnet
- Technology: dotnet-install
- GitHub Login: @adegeo
- Microsoft Alias: adegeo
Hi @bdelavega-maralytix I think this would be better to give to the product group, if something can then be added to the docs to avoid this problem or solve it when someone else runs into it, I could do that. But looking at your issue it seems too complex for me, and I don't have a mac or ARM processor to help figure it out. But I think the product team should be aware of the situation you got yourself in to so that they can help prevent it (and get you out of it hehe)
I think I can move this issue, so I'll do that now.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
@adegeo - Moving it is fine.
For my purposes, I figured out how to remove the dotnet additions to the path environment variable. I did this:
cd /etc/paths.d
sudo rm dotnet
Then I deleted the dotnet folders and reinstalled 6.0.2 SDK. Now everything works fine.