-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to remove old .NET Core SDKs? #2295
Comments
Cough, cough: https://github.com/dotnet/cli/issues/6896. :) |
When you click on one of those installed SDKs, it will show you the version. For previews, it should show 4 part version (e.g. 2.1.300.8866 for .Net Core SDK 2.1.300 "RTM"). For non-previews, it will show only 3 parts (e.g. 2.1.300). |
Thanks, @svick. I just a few minutes ago figured that out. But it's so tedious to look through each one and uninstall each one (each with its own UAC prompt, uninstall experience, etc). As a workaround, here's what I came up with: $products = Get-WmiObject -Class win32_product
$remove = $products |? { $_.name -match 'Microsoft .NET Core SDK - 2.1.200' } I would then review the contents of $remove = $products |? { $_.name -match 'Microsoft .NET Core SDK - 2.1.200' -and $_.version -ne '8.50.7609' } Finally, I would remove all the selected MSIs with: $remove.identifyingnumber |% { Start-Process msiexec -wait -ArgumentList "/x $_" } I can't use the |
Closing this as the question is answered and dotnet/cli#6896 tracks preventing these from accumulating via build-to-build upgrades of VS. If you feel there's a change that is needed to the installer that is not dotnet/cli#6896, file a new issue on the dotnet/cli repo. |
Here's a small improvement to reduce errors with @AArnott's excellent script. You can get errors like "This installation package could not be opened" if you aren't in System32 when doing the uninstall.
|
Can unnecessary runtimes be removed this way also? |
@dub505 I believe those can just be deleted |
How do we do this for Mac or Linux? |
cc @nguerrera |
Hmm, this doesn't work on my pc. I had 12 different .Net Core SDK's installed, when I ran the script, I was prompted xx times to accept uninstalling and everything looked promising. But after the script ended, every of the 12 different SDK's were still there, and i had to remove them manually in Windows App's list. :( Thanks for the efforts everyone :) |
Which one of them can be safely removed, if I only build from VS 2017/2019? |
Another, faster Powershell script:
|
Instead of msiexec, consider The uninstall commands for installed SDKs can be queried from the registry as follows (and the above scripts could be adapted to execute the UninstallString or QuietUninstallString instead of msiexec):
|
And here is a script function that attempts to silently uninstall (except for UAC prompt) outdated SDKs, keeping only the latest patch version of each (unless using the -All param). Dry run with
|
https://github.com/Klocman/Bulk-Crap-Uninstaller works pretty well for this as well |
The .NET Core command-line (CLI) tools repository provides uninstall scripts.
|
After installing .NET Core 2.1 SDK (great job, BTW),
dotnet --info
showed me I had all this installed:How do I remove the old cruft (especially the previews)?
The text was updated successfully, but these errors were encountered: