Fix aspire update --self to install to current CLI location #13722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #13140
Description
Previously,
aspire update --selfalways installed to$HOME/.aspire/binregardless of where the CLI was originally installed. This caused issues when the CLI was installed to a custom path like/usr/local/binusing--install-path.Now the command installs the update to the same directory as the currently running CLI executable, determined via
Environment.ProcessPath. If the update fails due to insufficient permissions (e.g., writing to a protected directory like/usr/local/bin), a helpful error message is displayed advising the user to run with elevated permissions.The changes were tested manually with:
Permission error handling was tested on Linux with:
Checklist
UnauthorizedAccessExceptionpath requires real filesystem permission restrictions that are difficult to reliably trigger in unit tests without mocking infrastructure. The existing 21 tests continue to pass.<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate~/.aspire/bin).