Closed sheldonhull closed 5 years ago
I just ran into this as well with a module from the PSGallery with just a major.minor version. Note that it only happens with the module has already been downloaded and PSDepend is doing a compare against the gallery. The issue stems from this code:
Running that line returns the following:
Find-Module -Name $Name -Repository $Repository | Measure-Object -Property Version -Maximum | Select-Object -ExpandProperty Maximum
0.3
This compared to what is returned with the existing module:
$Existing | Measure-Object -Property Version -Maximum | Select-Object -ExpandProperty Maximum
Major Minor Build Revision
----- ----- ----- --------
0 3 -1 -1
I'm wondering if the bug should be raised here or with PowerShellGet?
The only thing I can think of is to cast the output from Find-Module
to System.Version
. Not sure what that might break, though.
Just ran into this on a revived project:
Could not compare "2.2" to "2.0.0". Error: "Cannot convert the "2.0.0" value of type "System.Version" to type "System.Double"."
At C:\Users\appveyor\Documents\WindowsPowerShell\Modules\PSDepend\0.3.0\PSDependScripts\PSGalleryModule.ps1:198 char:10
+ ($GalleryVersion = (& $GetGalleryVersion)) -le $ExistingVersi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : ComparisonFailure
Could not compare "2.2" to "2.2". Error: "Cannot convert the "2.2" value of type "System.Version" to type "System.Double"."
At C:\Users\appveyor\Documents\WindowsPowerShell\Modules\PSDepend\0.3.0\PSDependScripts\PSGalleryModule.ps1:198 char:10
+ ($GalleryVersion = (& $GetGalleryVersion)) -le $ExistingVersi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : ComparisonFailure```
https://ci.appveyor.com/project/tlindsay42/armorpowershell/build/job/sh0m0u5jm13c267o#L62
https://travis-ci.org/tlindsay42/ArmorPowerShell/jobs/556512385#L582
This error happens when using psdepent 0.3.0. The below was workign until yesterday when MS pushed a new version of powershellget but the new version is 2.2 instead of being 2.2.0.
ERROR: Could not compare "2.2" to "2.2". Error: "Cannot convert the "2.2" value of type "System.Version" to type "System.Double"."
'PowerShellGet' = @{
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
}
}
Using this statement to download a nuget package via nuget.exe provides an error that cannot convert double to version. This had been working until lately, so perhaps so version parsing method changed?
I'm currently using PSDepend version:
0.1.62