Skip to content

Uninstall-Module shouldn't require -AllowPrerelease when a prerelease version is being uninstalled. #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mklement0 opened this issue Apr 23, 2021 · 3 comments · Fixed by #523
Assignees
Labels
Area-Uninstall Issue-Bug Something isn't working
Milestone

Comments

@mklement0
Copy link

Steps to reproduce

$moduleName = 'PSReadLine'
$prereleaseVersion = '2.2.0-beta2'

# Install with -AllowPrerelease
Install-Module -Force -AllowPrerelease $moduleName -RequiredVersion $prereleaseVersion

try {
  { Uninstall-Module -ErrorAction Stop $moduleName -RequiredVersion $prereleaseVersion } | Should -not -Throw
}
finally {
 # Uninstalling only succeeds with -AllowPrerelease
 Uninstall-Module -AllowPrerelease $moduleName  -RequiredVersion $prereleaseVersion 
}

Expected behavior

The test should pass.

Actual behavior

The test fails, because -AllowPrerelease is unexpectedly required.

Expected no exception to be thrown, but an exception 
"The '-AllowPrerelease' parameter must be specified when using the Prerelease string in MinimumVersion, MaximumVersion, or RequiredVersion." 
was thrown

Environment data

PowerShell Core 7.2.0-preview.5
@daxian-dbw daxian-dbw transferred this issue from PowerShell/PowerShell May 3, 2021
@daxian-dbw
Copy link
Member

@alerickson @anamnavi and @PaulHigin This is another one :)

@alerickson
Copy link
Member

@mklement0 this is also addressed and will be out in the next release.

@alerickson alerickson self-assigned this May 3, 2021
@alerickson alerickson transferred this issue from PowerShell/PowerShellGetv2 May 3, 2021
@SydneyhSmith SydneyhSmith added Area-Uninstall Issue-Bug Something isn't working labels May 6, 2021
@SydneyhSmith SydneyhSmith added this to the 3.0-Resolved milestone May 6, 2021
@SydneyhSmith
Copy link
Collaborator

-AllowPrerelease should not be required and we should also parse a prerelease version that is provided and uninstall that version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Uninstall Issue-Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants