Why you need to uninstall old versions of .NET Core

On October 10, .NET 8 reaches Release Candidate 2 (RC-2). It’s time to start thinking about removing and migrating old versions of .NET Core from our developer machine.

The .NET Core is a popular, open-source, cross-platform framework developed by Microsoft, designed for building modern, cloud-based, and internet-connected applications. As with all software, .NET Core performs various updates and iterations to improve functionality and security.


Security risks of old versions

It’s not secure to have installed an unpatched version of .NET Core in our developer machine like .NET 5. Here, I discuss some reasons recommended to avoid using old versions.

What to keep in mind about security:

  • Vulnerabilities & exploits:  There is a possibility that older versions of .NET Core have security flaws that have since been identified and corrected in more recent releases. Cybercriminals are clever and will frequently target known vulnerabilities in older software. It places our applications and data in a precarious position to be compromised.
  • Lack of support:  Microsoft offers support for the most recent version of.NET Core and the version with Long-Term Support (LTS), but not for older versions. If you do not have official support, you will not receive critical security updates, leaving your machine vulnerable to various dangers.
  • Compliance issues:   Running obsolete software can put a company in violation of data protection requirements if the program isn’t updated. This violation of compliance not only puts the safety and privacy of user data in jeopardy but also can result in harsh penalties and irreparable harm to your company’s reputation.

Why uninstall old versions?

As IT professionals, we must implement adequate security policies that protect our apps and data from unwanted access and manipulation in a digital landscape defined by increasingly sophisticated cyber threats. By adopting a routine system update and optimization culture, we can be at an advantageous frontier of exceptional security, support, performance, and future readiness. These are some topics that we need to care about.

  1. Enhanced security:  We may verify that our applications operate on a platform with the most recent security updates and fixes by deleting older versions of .NET Core and installing the most recent edition of .NET Core. This will reduce the likelihood of an exploit being used against your system.
  2. Support and community assistance:  Keeping up with the latest updates ensures you access official support and a thriving community of developers who can offer assistance and share knowledge regarding secure programming methods.
  3. Performance improvements: New versions often come with optimizations and performance enhancements, allowing our applications to run faster and more efficiently.
  4. Future-proofing:  Keeping our system updated prepares us for future releases and ensures compatibility with the latest tools, libraries, and frameworks in the .NET ecosystem.
  5. Recommended action: the security enterprises strongly urge all users and administrators to uninstall outdated versions of .NET Core and upgrade to the latest stable release. The process is straightforward, and guides can assist us with the transition. Adopting this practice is not just a matter of maintaining operational security; it is a proactive measure to protect your valuable data and digital assets against emerging cyber threats.

By paying attention to this message and acting accordingly, you help to create a more secure and reliable operating environment for everyone. Remember that cybersecurity is a shared responsibility, and staying current is essential.

How can you uninstall old versions?

For this article, I’m using the dotnet-code-unistall from a GitHub repository.

Download the uninstaller tool dotnet-core-uninstall-last-version.msi  from https://github.com/dotnet/cli-lab/releases.

dotnet-core-uninstall-last-version

Download, execute and follow these steps

1) Welcome screen, click on “Next”:

Microsoft .NET Core SDK Uninstall Tool

2) Confirm the path to install:

Microsoft .NET Core SDK Uninstall Tool

3) Click on the “Install” button.

Microsoft .NET Core SDK Uninstall Tool

After the installation, go to the installation folder and “Open in Terminal” should be in your language, as mine is in Portuguese:

Microsoft .NET Core SDK Uninstall Tool

You can also open in the CMD prompt and type “cd C:\Program Files (x86)\dotnet-core-uninstall”.

I demonstrate here 3 commands:

  • list - command to list all SKDs and Runtime installed
  • dry-run - the command that outputs a preview of what will be removed, so after checking the output and it is according to your objective, you can run the remove command;
  • remove - this command will execute the installation. The parameters are --sdk for SDKs or --runtime to remove runtimes and the parameter --all that you can add -bellow on it and specify the version below you desire to remove, for example, dotnet-core-uninstall remove --sdk --all-below 7.0.402.

Let’s do it.

Execute the “dotnet-core-uninstall list” command to check what is installed on your machine.

 In my sample, we have from 5 to 8 .NET SDKs:

Windows Powershell

Run the dry-run to check what will be removed. If I want to remove all but the .NET 8 version in this sample, I use this command: “dotnet-core-uninstall dry-run --sdk --all-below 8.0.100” to check what will be done:

Windows Powershell

The output shows:

 *** DRY RUN OUTPUT

Specified versions:

  Microsoft .NET SDK 7.0.402 (x86)

  Microsoft .NET SDK 6.0.415 (x86)

  Microsoft .NET SDK 6.0.415 (x64)

  Microsoft .NET SDK 5.0.408 (x86)

If you want to preserve the last .NET version, 7, you can run this command: “dotnet-core-uninstall dry-run --sdk --all-below 7.0.402” and check what will be removed. Pay attention to the version.

Windows Powershell

Also, you can check what preview versions you have on your system running the: “dotnet-core-uninstall dry-run --sdk --all-previews.”

Let’s remove them!

Run the terminal or CMD prompt in Administrator mode and run the desired command. In my sample, I use this: “dotnet-core-uninstall remove --sdk --all-below 7.0.402”. I choose to keep the .NET 7.

You will be prompted to confirm by typing “y,” and after that, all SDKs below the prompt will be removed:

Windows Powershell

I hope this article is helpful for you or someone else on your team.

You can find more information at the .NET Core official support policy. https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core.


Similar Articles