As .Net Core toolchain is rapidly evolving, I found myself spending a bit of time ensuring that I only keep latest versions of .Net Runtimes / SDKs / Bundles by uninstalling older version manually through App & Features Wizard. There is now an easier way to do this.
Behold DotNet-Core-Uninstall project. The .Net Foundation community is building this gem to help us with this task. Currently, there is no Chocolatey package yet, so go ahead and install the latest msi under releases.
List all of the installed SDKs / Runtimes / Bundles:
dotnet-core-uninstall list
Do a dry-run to understand which SDKs will be removed:
dotnet-core-uninstall dry-run --all-lower-patches --sdk
Delete all but the latest patches of the SDKs:
dotnet-core-uninstall remove --all-lower-patches --sdk
Any SDKs that are currently in use by VS2017/VS2019 are not uninstalled and may require manual action. So we can uninstall a specific version like this:
dotnet-core-uninstall remove 2.1.701 --sdk
This is now easy to maintain the installations going forward. NOTE, any SDKs/runtimes installed through VS tooling will be managed and upgraded by the VS Installer so this only applies to older or one off installations. Lastly, this tool also works on Mac OS as well, just download the tar.gz version.