dotnet / dotnet/core

Proposal: Unified Cross-Platform .NET SDK Cleanup & Version Management Tooling

Open
#10,164 1 comment 1 reaction 0 assignees View on GitHub
area-release-notes
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

### URL(s)

N/A – This request is not related to any existing release notes.
It is a standalone feature proposal for .NET SDK cleanup and version management.

### Description

## Summary

Managing multiple .NET SDK and Runtime versions across Windows, Linux, and macOS has become increasingly challenging—especially in environments using .NET 7/8/9, multi-architecture setups (x64 + arm64), CI/CD pipelines, and long-lived developer machines.

Today, .NET provides:

dotnet --list-sdks → lists versions only

OS-specific uninstall instructions → inconsistent and often incomplete

No official cross-platform cleanup/maintenance tool

No way to safely identify unused SDKs

No "dry-run" or automated removal process

As a result, SDK folders accumulate over time, causing path conflicts, global.json mismatches, container bloat, and broken build pipelines—especially in shared build servers and multi-repo organizations.

This proposal aims to introduce an official, consistent, cross-platform solution for cleaning, auditing, and managing installed .NET SDK versions.

## Proposed Feature

Introduce a new cross-platform command:
`dotnet sdk cleanup`

Dry-run mode:
`dotnet sdk cleanup --dry-run`

Automated cleanup:
`dotnet sdk cleanup --all-unused`

Machine-readable output:
`dotnet sdk cleanup --json`

Auditing capability:
`dotnet sdk audit`
-_Lists installed versions, global.json mappings, usage history, and age of SDKs._

## Problem Statement

Developers frequently struggle with:

1. Inconsistent removal procedures

Each OS requires different techniques to uninstall SDKs, which is error-prone and poorly documented.

2. Accumulation of unused SDKs

Installed SDK versions often remain indefinitely, leading to multi-GB clutter and degraded performance in CI runners.

3. global.json conflicts

Projects referencing older SDK versions can unexpectedly break when outdated SDK folders are manually removed or overwritten.

4. Multi-architecture issues

macOS and Linux often contain both arm64 and x64 SDK installations; safely removing one is difficult.

5. Docker/CI environments

In containers, every MB matters—yet SDKs accumulate unless manually pruned.

6. No programmatic cleanup methods

Automation scripts must manually inspect directory structures instead of using an official API or CLI mechanism.

In short:
We have a great way to install SDKs, but no official way to manage or clean them.

### 🏷️ Suggested Labels

- **area-SDK**
Indicates that this proposal relates directly to .NET SDK behavior, version management, and CLI enhancements.

- **enhancement**
Marks this as a feature request rather than a bug report.

- **area-UX**
Highlights that the proposal improves developer experience across platforms.

- **doc** *(optional)*
Suggests adding or updating official documentation to support cross-platform SDK cleanup workflows.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.