Remove the .NET runtime and SDK - .NET (2024)

  • Article

Over time, as you install updated versions of the .NET runtime and SDK, you may want to remove outdated versions of .NET from your machine. Uninstalling older versions of the runtime may change the runtime chosen to run shared framework applications, as detailed in the article on .NET version selection.

Should I remove a version?

The .NET version selection behaviors and the runtime compatibility of .NET across updates enables safe removal of previous versions. .NET runtime updates are compatible within a major version band such as 7.x and 6.x. Additionally, newer releases of the .NET SDK generally maintain the ability to build applications that target previous versions of the runtime in a compatible manner.

In general, you only need the latest SDK and latest patch version of the runtimes required for your application. Instances where you might want to keep older SDK or runtime versions include maintaining project.json-based applications. Unless your application has specific reasons for earlier SDKs or runtimes, you may safely remove older versions.

Determine what is installed

The .NET CLI has options you can use to list the versions of the SDK and runtime that are installed on your computer. Use dotnet --list-sdks to see the list of installed SDKs and dotnet --list-runtimes for the list of runtimes. For more information, see How to check that .NET is already installed.

Uninstall .NET

.NET uses the Windows Apps & features dialog to remove versions of the .NET runtime and SDK. The following figure shows the Apps & features dialog. You can search for core or .net to filter and show installed versions of .NET.

Remove the .NET runtime and SDK - .NET (1)

Select any versions you want to remove from your computer and click Uninstall.

The best way for you to uninstall .NET is to mirror the action you used to install .NET. The specifics depend on your chosen Linux distribution and the installation method.

Preview releases are manually installed, and must be manually uninstalled. For more information, see the Scripted or manual section.

You can remove the following types if .NET installations:

  • Package manager
  • Manually or scripted installs

Package manager

There's no need to first uninstall the .NET SDK when upgrading it using a package manager, unless you're upgrading from a preview version that was manually installed. The package manager update or refresh commands will automatically remove the older version upon the successful installation of a newer version. If you have a preview version installed, uninstall it.

If you installed .NET using a package manager, use that same package manager to uninstall the .NET SDK or runtime. .NET installations support most popular package managers. Consult the documentation for your distribution's package manager for the precise syntax in your environment:

  • apt-get(8) is used by Debian based systems, including Ubuntu.
  • yum(8) is used on Fedora, CentOS, Oracle Linux, and RHEL.
  • zypper(8) is used on openSUSE and SUSE Linux Enterprise System (SLES).
  • dnf(8) is used on Fedora.

In almost all cases, the command to remove a package is remove.

The package name for the .NET SDK installation for most package managers is dotnet-sdk, followed by the version number. Only the major and minor version numbers are necessary: for example, the .NET SDK version 8.0.200 can be referenced as the package dotnet-sdk-8.0.

For machines that have installed only the runtime, and not the SDK, the package name is dotnet-runtime-<version> for the .NET runtime, and aspnetcore-runtime-<version> for the entire runtime stack.

Scripted or manual

If you installed .NET using the dotnet-install script, or by extracting a tarball, you must remove .NET using the manual method.

When you manually install .NET, it's generally installed to the /usr/share/dotnet/, /usr/lib/dotnet/, or the $HOME/.dotnet directory. The SDK, runtime, and .NET host, are installed into separate sub directories. These "component" directories contain a directory for each version of .NET. By removing the versioned directories, you remove that version of .NET from your system. These directories may vary depending on your Linux distribution.

There are three commands you can use to discover where .NET is installed: dotnet --list-sdks for SDKs, dotnet --list-runtimes for runtimes, and dotnet --info for everything. These commands don't list the .NET host. To determine which hosts are installed, check the /usr/share/dotnet/host/fxr/ directory. The following list represents the directories of a specific version of .NET, where the $version variable represents the version of the .NET:

  • SDK:

    /usr/share/dotnet/sdk/$version/

  • Runtime:

    The runtime is based on specific .NET product runtimes, such as Microsoft.AspNetCore.All or Microsoft.NETCore.App (the .NET runtime specifically). These are installed to the /usr/share/dotnet/shared/$product/$version directory, where $product is the product runtime. For example, you may see the following directories:

    /usr/share/dotnet/shared/Microsoft.NETCore.App/$version//usr/share/dotnet/shared/Microsoft.AspNetCore.App/$version//usr/share/dotnet/shared/Microsoft.AspNetCore.All/$version/
  • .NET host

    See Also
    Portal

    /usr/share/dotnet/host/fxr/$version/

Use the rm -rf command to remove a version of .NET. For example, to remove the 6.0.406 SDK, run the following command:

sudo rm -rf /usr/share/dotnet/sdk/6.0.406

Important

The version directories might not match the "version" you're uninstalling. The individual runtimes and SDKs that are installed with a single .NET release might have different versions. For example, you might have installed ASP.NET Core 8 Runtime, which installed the 8.0.2 ASP.NET Core runtime and the 8.0.8 .NET runtime. Each has a different versioned directory. For more information, see Overview of how .NET is versioned.

When you manually install .NET, it's generally installed to the /usr/local/share/dotnet/ or the $HOME/.dotnet directory. The SDK, runtime, and .NET host are installed into separate sub directories. These "component" directories contain a directory for each version of .NET. By removing the versioned directories, you remove that version of .NET from your system. These directories may vary depending on your macOS version.

There are three commands you can use to discover where .NET is installed: dotnet --list-sdks for SDKs, dotnet --list-runtimes for runtimes, and dotnet --info for everything. These commands don't list the .NET host. To determine which hosts are installed, check the /usr/local/share/dotnet/host/fxr/ directory. The following list represents the directories of a specific version of .NET, where the $version variable represents the version of the .NET:

  • SDK:

    /usr/local/share/dotnet/sdk/$version/

  • Runtime:

    The runtime is based on specific .NET product runtimes, such as Microsoft.AspNetCore.All or Microsoft.NETCore.App (the .NET runtime specifically). These are installed to the /usr/local/share/dotnet/shared/$product/$version directory, where $product is the product runtime. For example, you might see the following directories:

    /usr/local/share/dotnet/shared/Microsoft.NETCore.App/$version/dotnet --info/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/$version//usr/local/share/dotnet/shared/Microsoft.AspNetCore.All/$version/
  • .NET host

    /usr/local/share/dotnet/host/fxr/$version/

Use the rm -rf command to remove a version of .NET. For example, to remove the 6.0.406 SDK, run the following command:

sudo rm -rf /usr/local/share/dotnet/sdk/6.0.406

Important

The version directories might not match the "version" you're uninstalling. The individual runtimes and SDKs that are installed with a single .NET release might have different versions. For example, you might have installed ASP.NET Core 8 Runtime, which installed the 8.0.2 ASP.NET Core runtime and the 8.0.8 .NET runtime. Each has a different versioned directory. For more information, see Overview of how .NET is versioned.

Important

If you're using an Arm-based Mac, such as one with an M1 chip, review the directory paths described in Install .NET on Arm-based Macs.

The .NET Uninstall Tool (dotnet-core-uninstall) lets you remove .NET SDKs and runtimes from a system. A collection of options is available to specify which versions should be uninstalled.

Visual Studio dependency on .NET SDK versions

Before Visual Studio 2019 version 16.3, Visual Studio installers called the standalone SDK installer for .NET Core version 2.1 or 2.2. As a result, the SDK versions appear in the Windows Apps & features dialog. Removing .NET SDKs that were installed by Visual Studio using the standalone installer may break Visual Studio. If Visual Studio has problems after you uninstall SDKs, run Repair on that specific version of Visual Studio. The following table shows some of the Visual Studio dependencies on .NET Core SDK versions:

Visual Studio version.NET Core SDK version
Visual Studio 2019 version 16.2.NET Core SDK 2.2.4xx, 2.1.8xx
Visual Studio 2019 version 16.1.NET Core SDK 2.2.3xx, 2.1.7xx
Visual Studio 2019 version 16.0.NET Core SDK 2.2.2xx, 2.1.6xx
Visual Studio 2017 version 15.9.NET Core SDK 2.2.1xx, 2.1.5xx
Visual Studio 2017 version 15.8.NET Core SDK 2.1.4xx

Starting with Visual Studio 2019 version 16.3, Visual Studio is in charge of its own copy of the .NET SDK. For that reason, you no longer see those SDK versions in the Apps & features dialog.

Remove the NuGet fallback directory

Before .NET Core 3.0 SDK, the .NET Core SDK installers used a directory named NuGetFallbackFolder to store a cache of NuGet packages. This cache was used during operations such as dotnet restore or dotnet build /t:Restore. The NuGetFallbackFolder was located under the sdk folder where .NET is installed. For example it could be at C:\Program Files\dotnet\sdk\NuGetFallbackFolder on Windows and at /usr/local/share/dotnet/sdk/NuGetFallbackFolder on macOS.

You may want to remove this directory, if:

  • You're only developing using .NET Core 3.0 SDK or .NET 5 or later versions.
  • You're developing using .NET Core SDK versions earlier than 3.0, but you can work online.

If you want to remove the NuGet fallback directory, you can delete it, but you'll need administrative privileges to do so.

It's not recommended to delete the dotnet directory. Doing so would remove any global tools you've previously installed. Also, on Windows:

  • You'll break Visual Studio 2019 version 16.3 and later versions. You can run Repair to recover.
  • If there are .NET Core SDK entries in the Apps & features dialog, they'll be orphaned.
Remove the .NET runtime and SDK - .NET (2024)

FAQs

Remove the .NET runtime and SDK - .NET? ›

The . NET Uninstall Tool ( dotnet-core-uninstall ) lets you remove . NET SDKs and runtimes from a system. A collection of options is available to specify which versions should be uninstalled.

Can I uninstall .NET runtime? ›

The . NET Uninstall Tool ( dotnet-core-uninstall ) lets you remove . NET SDKs and runtimes from a system. A collection of options is available to specify which versions should be uninstalled.

How do I remove the .NET SDK version? ›

2 Answers
  1. Steps for manually deleting an SDK or Runtime: Run. dotnet --info. ...
  2. To remove an SDK: The dotnet/sdk directory (e.g. C:\Program Files\dotnet\sdk) will have a sub-directory for each installed sdk version. ...
  3. To remove a runtime: The dotnet/shared directory (e.g. C:\Program Files\dotnet\shared\Microsoft.
Dec 4, 2023

Do I need .NET runtime if I have SDK? ›

Runtime (Windows) The runtime includes everything you need to run .NET applications. The runtime is also included in the SDK.

How to uninstall .NET SDK using cmd? ›

Uninstall . NET SDK
  1. Open the list of installed programs (appwiz. cpl).
  2. In the list, select CRMDotNetInstall, and then select Uninstall.
  3. Use the Gacutil.exe tool to remove the CRMEntityWizard assembly from GAC. At a command prompt, run the following: gacutil -u CRMEntityWizard.

How do I remove SDK? ›

Uninstall the tool
  1. Open Add or Remove Programs.
  2. Search for Microsoft . NET SDK Uninstall Tool .
  3. Select Uninstall.
Mar 10, 2023

How do I disable .NET runtime? ›

  1. Press Windows + R key to open Run command.
  2. Type services.msc in the Run box and click on OK.
  3. Find Microsoft .NET Framework service.
  4. Double click on it and open Properties.
  5. Navigate to General tab, under Service status, select Stop button.
  6. From Startup type menu, select Disabled option, click on Apply and then OK.
Sep 22, 2021

What is .NET SDK? ›

Modern . NET projects are associated with a software development kit (SDK). Each project SDK is a set of MSBuild targets and associated tasks that are responsible for compiling, packing, and publishing code.

How do I remove .NET from my computer? ›

1. Using Control Panel:
  1. Open the Control Panel on your Windows machine.
  2. Go to “Programs” or “Programs and Features.”
  3. Look for “Microsoft . ...
  4. Select the version of . ...
  5. Click “Uninstall/Change” or “Change/Remove” (the wording may vary).
  6. Follow the on-screen instructions to complete the uninstallation.
Feb 14, 2024

How do I uninstall Microsoft SDK? ›

Can i delete "C:\Program Files (x86)\Microsoft SDKs" if i've remove visual studio?
  1. Right-Click on Start then click on Run.
  2. Type: Control Panel and click on OK.
  3. Click on "Uninstall a program"
  4. Search on the list for "Microsoft Windows SDK" or "Windows SDK AddOn" and uninstall them.
Dec 26, 2023

Why is .NET runtime needed? ›

There are several benefits of using the . NET runtime for developing applications: Cross-platform Compatibility: . NET applications can run on various platforms like Windows, Linux, and macOS, making them highly portable and versatile.

Do I need Microsoft .NET runtime? ›

If you're not a software developer, all you care about is that it works. Any program written in . Net needs to have the . Net runtime installed.

What is the .NET runtime used for? ›

. NET is a software framework developed by Microsoft. It provides a platform for building and running a wide range of applications, including web applications, desktop software, mobile apps, and more. .

How to check which .NET SDK is installed? ›

Determine what is installed

The . NET CLI has options you can use to list the versions of the SDK and runtime that are installed on your computer. Use dotnet --list-sdks to see the list of installed SDKs and dotnet --list-runtimes for the list of runtimes.

How do I remove the .NET Framework from Windows 10? ›

How to uninstall . NET Framework
  1. In Windows 10 or Windows 11, enter Turn Windows features on or off in the Windows search bar.
  2. Click the Turn Windows features on or off result.
  3. Uncheck . NET Framework 3.5 (includes . NET 2.0 and 3.0).
  4. Click OK.
Feb 20, 2024

Can I delete Windows desktop runtime? ›

You can uninstall Desktop Runtime from the control panel, the command line, or by using Microsoft PowerShell.

Is Microsoft .NET runtime necessary? ›

If you're not a software developer, all you care about is that it works. Any program written in . Net needs to have the . Net runtime installed.

Why do I need .NET desktop runtime? ›

The . NET Desktop Runtime is a technology that enables the user to run existing Windows desktop applications from their workstation. This release includes the . NET Runtime, which is a managed component, so it doesn`t need to be installed separately.

What happens if I uninstall .NET Framework? ›

Uninstalling the Microsoft .NET Framework may cause some applications to cease to function. In general, you should not uninstall any versions of the .NET Framework that are installed on your computer, because an application you use may depend on a specific version of the .NET Framework.

Top Articles
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 6492

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.