cli-lab icon indicating copy to clipboard operation
cli-lab copied to clipboard

How to uninstall the old runtime?

Open GF-Huang opened this issue 4 years ago • 23 comments
trafficstars

image

image

image


addition:

image

And why the 5.0.401 SDK size is so small just 180 KB?

GF-Huang avatar Sep 30 '21 17:09 GF-Huang

@GF-Huang it looks like you can't see the runtimes you want to uninstall in windows' add/remove programs UI, is that right? If so, that means that you likely installed those runtimes via zip files, Visual Studio, or in sdk bundles. If that's the case, then this is not the right tool to uninstall these runtimes.

sfoslund avatar Oct 06 '21 21:10 sfoslund

That's upgraded by VS2019, but the VS Installer doesn't uninstall the older version while upgrading. So is it safe to delete older .NET folders manually?

GF-Huang avatar Oct 06 '21 22:10 GF-Huang

Hmm, VS2019 should manage its own installations. Are you able to uninstall them through the Visual Studio Installer?

sfoslund avatar Oct 06 '21 22:10 sfoslund

I can't, it only show me the .NET 5 runtime, but no the detailed versions.

image

GF-Huang avatar Oct 06 '21 22:10 GF-Huang

@GF-Huang hmm okay, is there a possibility that those runtimes came bundled with a SDK? What SDKs do you have installed?

sfoslund avatar Oct 07 '21 22:10 sfoslund

image

GF-Huang avatar Oct 08 '21 01:10 GF-Huang

@joeloff do you know which runtimes ship with which version of the SDK? We're trying to figure out why the 5.0 runtimes listed above weren't present in the registry, and I'm wondering if they were bundled with SDK installations.

sfoslund avatar Oct 08 '21 15:10 sfoslund

5.0.401 - 5.0.10 runtime 5.0.303 - 5.0.9 runtime 3.1.413 - 3.1.19 runtime 2.2.207 - 2.2.8 runtime

Those runtimes that show in ARP likely came through MU. The Desktop runtime will bring down both the desktop and runtime installers.

Deleting the folder will still leave them installed, e.g. if a repair was triggered the files will just be returned.

@sfoslund Does the uninstall tool check both the 32-bit and 64-bit registry entries? And does it scan for the windows-desktop runtime?

joeloff avatar Oct 08 '21 16:10 joeloff

Does the uninstall tool check both the 32-bit and 64-bit registry entries? And does it scan for the windows-desktop runtime?

No, https://github.com/dotnet/cli-lab/blob/main/src/dotnet-core-uninstall/Windows/RegistryQuery.cs#L26. It doesn't look for the windows desktop runtime and

sfoslund avatar Oct 11 '21 16:10 sfoslund

So in VS, if you selected the 3.1 Runtime, you'll get the targeting packs, runtime (.NET Core) and Desktop runtime. When Microsoft Update scan the machine, it could offer the Desktop Runtime, though I suspect it will offer an SDK instead because that includes the runtime targeting packs. It tries to offer the least number of bundles that target the most number of individual installs on the machine.

joeloff avatar Oct 11 '21 16:10 joeloff

I saw that the windows registry keeps track of the runtime versions under these keys:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sdk Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.NETCore.App Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App

So I think if we don't find any entry in the Windows Add/Remove applications on the Control Panel, we should delete the folder and also the corresponding key in the windows registry.

gitauto avatar Oct 31 '21 07:10 gitauto

@sfoslund for desktop, you'd want to include (displayName.IndexOf("Windows Desktop Runtime", StringComparison.OrdinalIgnoreCase) >= 0) Originally it shipped using "Shared Framework for Windows Desktop", but was changed later to be "Windows Desktop Runtime"

@gitauto deleting the files won't stop offerings from triggering. It would still be present and repair will just return everything to disk.

joeloff avatar Oct 31 '21 18:10 joeloff

So what's the conclusion? Is it safe for me to delete them manually?

GF-Huang avatar Nov 08 '21 21:11 GF-Huang

So what's the conclusion? Is it safe for me to delete them manually?

It would probably be safe but they would likely just be reinstalled by Microsoft update. It might be helpful if you could provide logs so we can figure out how these versions got left behind. Here's a log collection tool: https://www.microsoft.com/en-us/download/details.aspx?id=12493

sfoslund avatar Nov 08 '21 21:11 sfoslund

So what's the conclusion? Is it safe for me to delete them manually?

It would probably be safe but they would likely just be reinstalled by Microsoft update. It might be helpful if you could provide logs so we can figure out how these versions got left behind. Here's a log collection tool: microsoft.com/en-us/download/details.aspx?id=12493

vslogs.zip

GF-Huang avatar Nov 08 '21 22:11 GF-Huang

Based on the logs, I'm seeing standalone MSI installs for the following (which the uninstall tool won't remove).

{84BBB763-AD8F-4033-8429-3DFC7C9FF3E2} Microsoft .NET Runtime - 5.0.12 (x64) {9E190CBD-B034-491A-BD02-BDDBB4D67F74} Microsoft .NET Runtime - 5.0.11 (x64) {607A9135-1477-43AB-A8B0-7690DC1C58D3} Microsoft .NET Runtime - 5.0.10 (x64) {D55E73D8-86EB-4FC3-A957-54616AA3D961} Microsoft .NET Runtime - 5.0.9 (x64) {92A4F25F-BF29-4B3C-A206-7F46AEE24E9D} Microsoft .NET Runtime - 5.0.7 (x64) {879C9645-ADF3-4697-915B-00B76EBA629F} Microsoft .NET Runtime - 5.0.4 (x64) {FE6FF6ED-93DE-42E3-991D-346F0C1FC187} Microsoft .NET Runtime - 5.0.0 (x64)

@GF-Huang to remove these, grab the GUID on each line and run the following (I'm using the 5.0.0 version as an example)

msiexec /x {FE6FF6ED-93DE-42E3-991D-346F0C1FC187} IGNOREDEPENDENCIES=ALL

joeloff avatar Nov 08 '21 23:11 joeloff

If they are installed by standalone MSI, why I can't find them in control panel? Maybe they are installed by Windows Update?

It popup a window, seems not work.

image

GF-Huang avatar Nov 08 '21 23:11 GF-Huang

You left out the /x on the commandline

When installed with VS (or the EXE bundles when we have 10+ MSIs per release, the MSIs are hidden from ARP)

joeloff avatar Nov 08 '21 23:11 joeloff

Thank you, it works.

GF-Huang avatar Nov 08 '21 23:11 GF-Huang

You left out the /x on the commandline

When installed with VS (or the EXE bundles when we have 10+ MSIs per release, the MSIs are hidden from ARP)

How can I find the others GUID, such as AspNetCore and WindowsDesktop?

GF-Huang avatar Nov 08 '21 23:11 GF-Huang

@joeloff I found a tool to view the products and their GUID: https://github.com/suyouquan/SQLSetupTools#product-browser-22

image

By the way, is it safe to uninstall the older Microsoft .NET AppHost Pack by msiexec too?

GF-Huang avatar Nov 08 '21 23:11 GF-Huang

If you don't plan to target those it should be fine I think to remove those too.

joeloff avatar Nov 09 '21 04:11 joeloff

Issue still for .NET 6, I don't know why the old one is not removed when installing the new .NET runtime.

> dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

> dotnet --list-sdks
2.2.207 [C:\Program Files\dotnet\sdk]
3.1.423 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.304 [C:\Program Files\dotnet\sdk]
6.0.401 [C:\Program Files\dotnet\sdk]

GF-Huang avatar Sep 25 '22 23:09 GF-Huang