microsoft / microsoft/aspire

Aspire CLI needs an uninstall/cleanup command for script and PR installs

Open
#15,614 4 comments 2 reactions 2 assignees Claimed by @radical View on GitHub
area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Summary

When multiple Aspire CLI installation methods coexist (WinGet, release script, PR dogfood script), removing one install doesn't clean up its side effects. This leaves stale configuration that silently breaks the remaining installs.

## Problem

All Aspire CLI binaries share the same `~/.aspire/` config directory regardless of installation method. When a script or PR install is removed (by deleting the binary), the remaining install (e.g., WinGet) inherits stale config:

- **PR install leaves behind**: `channel = pr-NNNNN` in global config, hive directory (`~/.aspire/hives/pr-NNNNN/`), and VS Code extension
- **Dev/daily script install leaves behind**: `channel = daily` in global config

This causes the surviving install (e.g., WinGet stable 13.2.0) to resolve templates and packages from the wrong channel. For example, after removing a PR binary, the WinGet binary resolves `aspire new` to the PR SDK version and generates `NuGet.config` pointing to the local PR hive.

### Reproduction (W35 scenario)

1. Install stable via WinGet (13.2.0)
2. Install PR build via `get-aspire-cli-pr.ps1 15573`
3. Remove the PR binary: `Remove-Item ~/.aspire/bin/aspire.exe`
4. WinGet binary takes over but:
- `aspire config get channel` → `pr-15573` (stale)
- `aspire new` → resolves to PR SDK `13.3.0-pr.15573.g332b6688`
- Generated `NuGet.config` points to `~/.aspire/hives/pr-15573/packages`

## Proposal

Add an uninstall/cleanup mechanism that covers the full lifecycle. This could be:

1. **`aspire uninstall` command** — cleans up binary, PATH entry, channel config, hives, and optionally VS Code extension
2. **`--uninstall` flag on install scripts** — `get-aspire-cli.ps1 --uninstall` / `get-aspire-cli-pr.ps1 --uninstall`
3. **Automatic cleanup on reinstall** — when the stable install script detects a PR channel/hive, offer to clean it up

At minimum, the cleanup should:

- [ ] Remove `~/.aspire/bin/aspire.exe` (script installs)
- [ ] Remove `~/.aspire/bin` from User PATH
- [ ] Remove PR hive directories (`~/.aspire/hives/pr-*/`)
- [ ] Optionally uninstall the VS Code extension installed by PR script

## Current workaround

Users must manually:
```
aspire config set channel ""
Remove-Item -Recurse ~/.aspire/hives/pr-*
```

## Context

Found during CLI acquisition playbook Run 5 (scenarios W33–W36).

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.