Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit feba850

Browse files
authored
Fix CommandAlreadyAvailable error for PackageManagement module. (#333)
This is happening as Get-Command returns the local commands from PSModule.psm1 for the Find-Package, Install-Package and Uninstall-Package provider functions. Added check to ignore the commands from PSModule.psm1. Resolves #329
1 parent b47b406 commit feba850

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22
## 2.0.1
3-
Bug fix
3+
Bug fixes
44
- Resolved Publish-Module doesn't report error but fails to publish module (#316)
5+
- Resolved CommandAlreadyAvailable error while installing the latest version of PackageManagement module (#333)
56

67
## 2.0.0
78
Breaking Change

PowerShellGet/PowerShellGet.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ PrivateData = @{
5555
LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061'
5656
ReleaseNotes = @'
5757
## 2.0.1
58-
Bug fix
58+
Bug fixes
5959
- Resolved Publish-Module doesn't report error but fails to publish module (#316)
60+
- Resolved CommandAlreadyAvailable error while installing the latest version of PackageManagement module (#333)
6061
6162
## 2.0.0
6263

PowerShellGet/private/functions/Validate-ModuleCommandAlreadyAvailable.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function Validate-ModuleCommandAlreadyAvailable
5656
-WarningAction SilentlyContinue |
5757
Microsoft.PowerShell.Core\Where-Object { ($CommandNames -contains $_.Name) -and
5858
($_.ModuleName -ne $script:PSModuleProviderName) -and
59+
($_.ModuleName -ne 'PSModule') -and
5960
($_.ModuleName -ne $CurrentModuleInfo.Name) }
6061
if($AvailableCommands)
6162
{

0 commit comments

Comments
 (0)