Skip to content

Make dotnet workload clean --all remove workload sets and manifests#52818

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/enhance-workload-clean-command
Draft

Make dotnet workload clean --all remove workload sets and manifests#52818
Copilot wants to merge 4 commits intomainfrom
copilot/enhance-workload-clean-command

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

dotnet workload clean --all left workload sets and manifests on disk, preventing users from recovering from corrupted workload states.

Changes

  • FileBasedInstaller: Added DeleteAllWorkloadSetsAndManifests() called when cleanAllPacks=true

    • Removes all workload sets from sdk-manifests/{featureBand}/workloadsets/
    • Removes all manifests from sdk-manifests/{featureBand}/{manifestId}/
    • Removes install state files (default.json)
    • Removes workload set and manifest installation records
  • Test: Added GivenWorkloadCleanAllFileBasedItRemovesWorkloadSetsAndManifests covering both user-local and system-wide scenarios

  • Localization: Added WorkloadCleanAllComplete resource string with xlf updates

  • Unrelated fix: Corrected _testAssetsManagerTestAssetsManager in GivenDotnetSlnList (pre-existing bug blocking build)

Behavior

Before:

$ dotnet workload clean --all
# Removes packs only; workload sets and manifests remain

After:

$ dotnet workload clean --all
# Removes ALL workload artifacts across all feature bands
# SDK returns to state as if no workloads were installed
Original prompt

This section details on the original issue you should resolve

<issue_title>dotnet workload clean --all should remove all workload artifacts to help recover from bad states</issue_title>
<issue_description>## Summary

dotnet workload clean --all should be enhanced to remove all workload-related artifacts on disk, including workload sets json files and manifests, to help users fully recover from corrupted or bad workload states.

Background

While working on #52434 (fixing workload repair to handle missing manifests), I observed that it's very difficult for users to recover from certain bad workload states.

For example, say a package manager deletes a manfiest file. Then, if a user deletes the sdk-manifests folder manually to try to fix this, this isn't sufficient to reset workloads to a clean state—somewhere on disk, the SDK still thinks workloads are installed. Users currently have no reliable way to get back to a "blank slate" for workloads.

Problem

dotnet workload clean --all does not remove all workload-related components:

  • Workload sets may remain on disk
  • Other artifacts that track installed workload state persist
  • Users can get stuck in states where workloads appear installed but are broken

Proposed Solution

Enhance dotnet workload clean --all to:

  1. Remove workload sets
  2. Remove all manifest-related files
  3. Clear any other persisted state that tracks installed workloads
  4. Effectively restore the SDK to a state as if no workloads were ever installed

This would give users a reliable escape hatch when workloads get into a bad state, rather than requiring manual hunting for files across the disk.

Additional Context

<agent_instructions>dotnet workload clean was created before workload sets. Let's have the --all flag also remove all workload set information and see if that can help reset into the original state.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 3, 2026 21:14
- Enhanced FileBasedInstaller.GarbageCollect to call DeleteAllWorkloadSetsAndManifests when cleanAllPacks is true
- DeleteAllWorkloadSetsAndManifests removes:
  - All workload sets from sdk-manifests/{featureBand}/workloadsets/
  - All manifests from sdk-manifests/{featureBand}/{manifestId}/
  - All install state files (default.json)
  - Installation records for workload sets and manifests
- Added WorkloadCleanAllComplete resource string
- This gives users a complete reset option when workloads get into bad states

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
- Added GivenWorkloadCleanAllFileBasedItRemovesWorkloadSetsAndManifests test
- Fixed pre-existing bug in GivenDotnetSlnList (TestAssetsManager naming)
- Updated xlf localization files for new string resource
- Tests verify that workload sets, manifests, and install state are removed

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
- Fix Path.GetFileName comparison for workloadsets folder check
- Remove extra blank line in test file
- Verify TestAssetsManager fix is correct (property from base SdkTest class)

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance dotnet workload clean to remove all artifacts Make dotnet workload clean --all remove workload sets and manifests Feb 3, 2026
Copilot AI requested a review from marcpopMSFT February 3, 2026 21:26
@marcpopMSFT marcpopMSFT assigned nagilson and unassigned marcpopMSFT Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet workload clean --all should remove all workload artifacts to help recover from bad states

3 participants