Skip to content

Refactor ZIP extraction for PowerShell compatibility#15692

Open
showbiz2k wants to merge 1 commit intomicrosoft:mainfrom
showbiz2k:patch-1
Open

Refactor ZIP extraction for PowerShell compatibility#15692
showbiz2k wants to merge 1 commit intomicrosoft:mainfrom
showbiz2k:patch-1

Conversation

@showbiz2k
Copy link
Copy Markdown

Description

Powershell core Expand-Archive cmdlet does not define the -DestinationPath parameter causing a failure to unpack. Powershell core uses -OutputPath instead.

Checklist

  • Is this feature complete?
    • [X ] Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • [X ] 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
    • [ X] 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
    • [ X] No
  • Does the change require an update in our Aspire docs?
    • Yes
    • [X ] No

Powershell core Expand-Archive cmdlet does not define the -DestinationPath parameter causing a failure to unpack.  Powershell core uses -OutputPath instead.
Copilot AI review requested due to automatic review settings March 29, 2026 12:37
@github-actions
Copy link
Copy Markdown
Contributor

🚀 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 -- 15692

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15692"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Aspire CLI installer PowerShell script to handle ZIP extraction across Windows PowerShell vs PowerShell (Core), aiming to fix a parameter incompatibility when calling Expand-Archive.

Changes:

  • Routes ZIP extraction through Invoke-WithPowerShellVersion to call different Expand-Archive parameter names for modern vs legacy PowerShell.

Expand-Archive -Path $ArchiveFile -DestinationPath $DestinationPath -Force -ErrorAction Stop

Invoke-WithPowerShellVersion -ModernAction {
Expand-Archive -Path $ArchiveFile -OutputPath $DestinationPath -Force -ErrorAction Stop
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ModernAction uses Expand-Archive -OutputPath, but elsewhere in this script (e.g., extension extraction) Expand-Archive is invoked with -DestinationPath under $Script:IsModernPowerShell. This inconsistency strongly suggests -OutputPath is not a valid parameter for the Expand-Archive available in pwsh, and will cause Windows installs under PowerShell Core to fail. Prefer keeping -DestinationPath for both branches, or (more robustly) select the parameter name by checking Get-Command Expand-Archive.Parameters for DestinationPath vs OutputPath.

Suggested change
Expand-Archive -Path $ArchiveFile -OutputPath $DestinationPath -Force -ErrorAction Stop
Expand-Archive -Path $ArchiveFile -DestinationPath $DestinationPath -Force -ErrorAction Stop

Copilot uses AI. Check for mistakes.
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.

2 participants