Skip to content

3.0.12-beta | Update-PSResource reinstalls modules installed by pre v3 PowerShellGet, even though there is no new version #619

@o-l-a-v

Description

@o-l-a-v

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Option one

Import-Module -Name 'PowerShellGet' -RequiredVersion '3.0.12'
Update-PSResource -Scope 'AllUsers' -Repository 'PSGallery' -Verbose

Option two

# Install a module with PowerShellGet v2.2.5
Import-Module -Name 'PowerShellGet' -RequiredVersion '2.2.5'
Uninstall-Module -Name 'AzureRM.LogicApp' -AllVersions
Install-Module -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Repository 'PSGallery' -Force

# Check if PowerShellGet v2.2.5 will update it.
# It righfully returns that no update is available.
Update-Module -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose

# Import PowerShellGet v3.0.12-beta
Remove-Module -Name 'PackageManagement','PowerShellGet','PSReadline' -Force
Import-Module -Name 'PowerShellGet' -RequiredVersion '3.0.12'

# Check if PowerShellGet v3.0.12-beta will update the module in question, once.
# Installs AzureRM.LogicApp _and_ AzureRM.Profile, same versions that are already installed.
Update-PSResource -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose # 

# Check if PowerShellGet v3.0.12-beta will update the module in question, twice.
# It righfully returns that no update is available.
Update-PSResource -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose # Says no update available

Expected behavior

Only modules and scripts where a newer version is available on PSGallery should be updated.

Actual behavior

Seems PowerShellGet v3 reinstalls modules installed by PowerShellGet v2, not caring if there is actually a newer version?

Error details

There is no error.

Environment data

* PowerShellGet v3.0.12-beta
* Windows 10 21H2 / 19044.1586
* Windows PowerShell 5.1 terminal

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions