PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
430 stars 138 forks source link

Upate-Module warns (and should not) when upgrading prerelease module #207

Open ghost opened 6 years ago

ghost commented 6 years ago

The new prerelease functionality for update-module is generating an inappropriate warning in some cases, and requiring the user to use -Force. This may be related to the Install-Module issue previously filed.

Current behavior

Repro case:

PS:> Install-Module mymodule -RequiredVersion 2.0.0-alpha -AllowPrerelease
PS:> #above item will succeed
PS:> Update-Module mymodule -RequiredVersion 2.0.0 
PS:> #above results in no-op & warning that the user is trying to update the same version. 
PS:> Update-Module mymodule -RequiredVersion 2.0.0-beta -AllowPrerelease
PS:> #above results in no-op & warning that the user is trying to update the same version. 

Expected Behavior

Update-module should succeed in both cases without warning. In the first case, note that -allowprerelease is not specified, because the user is not installing a prerelease version.

Your Environment


> $PSVersionTable
C:\> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.15063.726
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.726
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

C:\> Get-Module -ListAvailable PowerShellGet,PackageManagement
    Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.7.0    PackageManagement                   {Find-Package, Get-Package,
Script     1.1.6.0    PackageManagement                   {Find-Package, Get-Package,
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package,
Script     1.6.0      PowerShellGet                       {Install-Module, Find-Module
Script     1.5.0.0    PowerShellGet                       {Install-Module, Find-Module
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module
C:\> Get-PackageProvider
Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies,
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber,
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
Jaykul commented 6 years ago

I guess this is the problem with trying to shoe-horn semver into a system that doesn't support it.

We need a replacement/wrapper for Get-Module that returns the full SemVer version of the module.