I've found the command dotnet --list-runtimes
and it outputs (abbreviated) for me:
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
I want to remove specific AspNetCore.App runtimes to see if it helps me solve another, different issue - but I don't know how.
I've tried:
dotnet --list-runtimes
output)dotnet help
entries, but saw no relevant optionremove-runtime-sdk-version
readme but it tells me to use Add/Remove Programs, which doesn't help meI've considered removing the folders mentioned in my output, but am hesitant to just start deleting folders in Program Files
subfolders.
Is there a dotnet
command or other good way to remove runtimes, specifically AspNetCore versions, so that I can be 100% sure that the "Version Selection" feature from ASP.NET Core cannot pick up a wrong version?
Per the comments, I've tried the dotnet-core-uninstall
tool (preview release), but if I run dotnet-core-uninstall
it lists zero runtimes it could uninstall, only SDKs (and only 2.x versions at that).
For the older Versions of .Net, the tool dotnet-core-uninstall does not work. In my case, I had for example Microsoft.NETCore.App 3.1.23 (Maybe from an old Visual Studio 2019 installation?).
Here is what I did to get rid of it:
This folder is sometimes invisible, but its definitely there. In this folder I enabled the column 'Subject' that shows the content of the installer. The installers themselfs only have a cryptic filename like b23f58.msi. I picked the right installer for my Version of .Net runtime (The Version is also shown in the 'Subject' column).
And the runtime was gone.
Finding the right Installer can be a bit fiddely, because the names are not always the same as in the output of 'dotnet --info'. Just try until you hit the right one. As long as it has the old version number that you want to get rid of, you should be save.
ALternative way to find the installer: run
REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /f ".NET CORE" /s
on the console to show Versions of .Net Core
Then go to 'C:\ProgramData\Package Cache' and list the directories. They all start with a very long hex number with corresponds to the hex number from the command above. Go to the directory with the right hex number and find inside a msi-installer. Or just search in 'C:\ProgramData\Package Cache' for the Version number or 'NETCore' and see what you find.
Then proceed like above with the installer.
As my forst approach worked for me, so I haven't tried this myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With