Old .NET versions automatic uninstallation/removal

Mark Marco 25 Reputation points
2024-10-22T14:36:55.8833333+00:00

Hello,

How are you removing old versions of .NET from your devices? Is there a way to automate this?

To better clarify our issue, please see the screenshot below.

We just installed the latest version (6.0.35) for both: .NET Runtime and Desktop Runtime but older 6.0.33 versions are still there.

We need to automate those older versions removal.User's image I appreciate your response and help.

Thanks,

Mark

Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET .NET Runtime
Developer technologies .NET Other
Developer technologies ASP.NET Other
{count} vote

Accepted answer
  1. Anonymous
    2024-10-23T09:26:53.6266667+00:00

    Hi Mark Marco,

    As far as I know, the nearest solution to automatically uninstall the old version of .net core sdk is using .NET Uninstall tool. Be sure firstly follow this document and download .NET Uninstall Tool from the tool's releases page.

    Then run the following command to removes the .NET SDKs and runtimes, except the highest version:

    dotnet-core-uninstall remove --sdk --all-but-latest
    

    Reference: dotnet-core-uninstall remove


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Rena


2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-10-22T15:40:23.2566667+00:00

    the standard .net framework is update in place. but .net core is side by side. there is an uninstall utility you can run:

    https://learn.microsoft.com/en-us/dotnet/core/additional-tools/uninstall-tool-overview?pivots=os-windows


  2. Michael Taylor 60,161 Reputation points
    2024-10-22T16:36:49.4766667+00:00

    .NET Framework v4 is part of the OS now so you cannot remove it from newer Windows versions. It should be part of your Windows updates that you use so you are always on the latest 4.x version + security fixes.

    For older frameworks (<= v3) then you can remove using the standard uninstall process which can be automated. Winget could probably be used here if you have it installed.

    For NET Core platforms you could also use Winget. Otherwise the uninstall works as before. Note that you should ensure that none of the apps you're running use the older versions before you remove them. You can remove any minor/patch that isn't the latest though (e.g. 3.0.1 if 3.1 installed).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.