Skip to content

How to remove dotnet versions

Managing .NET SDK and runtime versions on your system can be crucial for maintaining a clean development environment and ensuring compatibility with different projects. This guide will walk you through the process of listing, individually removing, and batch removing .NET SDK and runtime versions using terminal commands.

List the .NET SDK Versions

Before removing any SDK versions, it’s helpful to see which versions are currently installed. To list all installed .NET SDK versions, use the following command in the terminal:

Terminal window
dotnet --list-sdks

This command will display output similar to the following:

6.0.423 [C:\Program Files\dotnet\sdk]
7.0.100-rc.2.22477.23 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
7.0.304 [C:\Program Files\dotnet\sdk]
8.0.100 [C:\Program Files\dotnet\sdk]
8.0.302 [C:\Program Files\dotnet\sdk]

Remove Individual .NET SDK Versions

To remove a specific .NET SDK version, use the rm command followed by the path of the SDK version you want to delete. Here’s the general format:

TODO

Remove an entire Version Series (e.g., 7.*)

If you want to remove all SDK versions within a major release series (e.g., all 6.x versions), you can use a wildcard * with the rm command:

TODO

This command will remove all installed .NET SDK versions that start with 7, such as 7.0.100, 7.0.200, etc.

List the .NET Runtime Versions

Similarly, you may want to list all installed .NET runtime versions. To list them, use the following command in the terminal:

Terminal window
dotnet --list-runtimes

This command will display output similar to the following:

Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0-rc.2.22476.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0-rc.2.22472.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Remove Individual .NET Runtime Versions

To remove a specific .NET runtime version, use the rm command followed by the path of the runtime version you want to delete. Here’s the general format:

TODO

Remove an Entire Runtime Version Series (e.g., 7.*)

If you want to remove all runtime versions within a major release series (e.g., all 7.x versions), you can use a wildcard * with the rm command:

TODO

This command will remove all installed .NET runtime versions that start with 7, such as 7.0.0, 7.0.3, etc.

References