Skip to content

Add --install-mode tool support to get-aspire-cli-pr scripts#16535

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-dotnet-tool-install-option
Draft

Add --install-mode tool support to get-aspire-cli-pr scripts#16535
Copilot wants to merge 3 commits intomainfrom
copilot/add-dotnet-tool-install-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Description

The PR dogfooding scripts (get-aspire-cli-pr.{sh,ps1}) only installed the CLI from RID-specific native archives. They now also support installing the Aspire.Cli dotnet tool globally from the same PR's NuGet hive.

New flags (default behavior unchanged):

  • --install-mode archive|tool / -InstallMode Archive|Tool
  • --force / -Force — required to replace an existing global Aspire.Cli (uses dotnet tool update --allow-downgrade so PR versions can be pinned in either direction).

Tool-mode flow:

  • Skips cli-native-archives-<rid> download; still downloads/installs built-nugets + built-nugets-for-<rid> into the hive.
  • Locates the unique Aspire.Cli.<version>.nupkg in the populated hive, parses the exact version, and runs dotnet tool install --global Aspire.Cli --version <v> --add-source <hive> (or update --allow-downgrade with --force). Fails fast on zero/multiple Aspire.Cli packages.
  • Routes aspire config set -g channel through the resolved global tool shim path; routes PATH update to the dotnet global tools directory instead of <install-path>/bin.
  • Preserves VS Code extension install (still gated by --skip-extension).

Validations (tool mode, when not --hive-only):

  • Rejects an explicitly supplied --install-path (would split CLI location from hive location).
  • Requires dotnet on PATH.
  • Detects an existing global Aspire.Cli and fails unless --force is set.
  • --hive-only continues to bypass all tool-mode-only checks.

Tests: new PRScriptToolModeTests (23 tests, bash + PowerShell) covering help text, invalid-mode rejection, dry-run/WhatIf flow (asserts native archive is skipped and dotnet tool install ... --add-source <hive> is shown), custom-install-path rejection, hive-only bypass, extension preservation, PATH routing, and find_aspire_cli_package_version / Find-AspireCliPackageVersion for success/missing/multiple cases.

# Install the CLI from PR 1234 as a global dotnet tool
./eng/scripts/get-aspire-cli-pr.sh 1234 --install-mode tool

# Replace an existing global Aspire.Cli with the PR's version
./eng/scripts/get-aspire-cli-pr.sh 1234 --install-mode tool --force

# From locally-staged artifacts
./eng/scripts/get-aspire-cli-pr.sh --local-dir ./artifacts --install-mode tool

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 7k6vsblobprodcus337.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet build tests/Aspire.Acquisition.Tests/Aspire.Acquisition.Tests.csproj (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet test --project tests/Aspire.Acquisition.Tests/Aspire.Acquisition.Tests.csproj --no-launch-profile -- --filter-class *.PRScriptToolModeTests --filter-not-trait quarantined=true --filter-not-trait outerloop=true t-in�� (dns block)
  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh api graphql -f query=query($owner:String!, $name:String!, $number:Int!) { repository(owner:$owner, name:$name) { pullRequest(number:$number) { headRefOid } } } -f owner=microsoft -f name=aspire -F number=1234 --jq .data.repository.pullRequest.headRefOid (http block)
  • https://api.github.com/repos/microsoft/aspire/pulls/1234
    • Triggering command: /usr/bin/gh gh api repos/microsoft/aspire/pulls/1234 --jq .head.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add option to install Aspire CLI from dotnet-tool package Apr 28, 2026
Copilot AI requested a review from radical April 28, 2026 22:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16535

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16535"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants