Skip to content
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

Updating a module that is not using semantic version fails #118

Open
johlju opened this issue Jul 24, 2020 · 3 comments
Open

Updating a module that is not using semantic version fails #118

johlju opened this issue Jul 24, 2020 · 3 comments

Comments

@johlju
Copy link

johlju commented Jul 24, 2020

I have a module dependency of PSPKI which has a version of 3.5. When using PSDepend to verify this module is the current one it fails with the below error. This recently started when PSDepend was updated to a newer version.

PSGalleryModule.ps1: C:\source\SqlServerDsc\output\RequiredModules\PSDepend\0.3.7\Public\Invoke-DependencyScript.ps1:195                              Line |                                                                                                                                                 195 |                      $Output = . $DependencyScript @splat                                                                                           |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                           | Could not compare "3.5" to "3.5.0". Error: "Cannot convert the "3.5.0" value of type "System.Management.Automation.SemanticVersion"                 | to type "System.Double"."
@sheldonhull
Copy link

I also am getting this.

Running Install-PSDepend
ERROR: Could not compare "1" to "1.0.0". Error: "Cannot convert the "1.0.0" value of type "System.Management.Automation.SemanticVersion" to type "System.Double"."
At /Users/sheldonhull/.local/share/powershell/Modules/PSDepend/0.3.8/Public/Invoke-DependencyScript.ps1:195 char:31
+                     $Output = . $DependencyScript @splat

@scottbilas
Copy link

Also with the Native package:

InvalidOperation: C:\Users\scott\Documents\PowerShell\Modules\PSDepend\0.3.8\PSDependScripts\PSGalleryModule.ps1:269
Line |
 269 |          $GalleryVersion -le $parsedSemanticVersion
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not compare "1.5" to "1.5.0". Error: "Cannot convert the "1.5.0" value of type
     | "System.Management.Automation.SemanticVersion" to type "System.Double"."

@scottbilas
Copy link

I believe this is the fix

--- .\PSGalleryModule.0.ps1
+++ .\PSGalleryModule.ps1
@@ -266,7 +266,7 @@
         [System.Management.Automation.SemanticVersion]::TryParse($ExistingVersion, [ref]$parsedSemanticVersion) -and
         [System.Management.Automation.SemanticVersion]::TryParse($GalleryVersion, [ref]$parsedTempSemanticVersion)
     ) {
-        $GalleryVersion -le $parsedSemanticVersion
+        $parsedTempSemanticVersion -le $parsedSemanticVersion
     }
     elseif ([System.Version]::TryParse($ExistingVersion, [ref]$parsedVersion)) {
         $GalleryVersion -le $parsedVersion

scottbilas added a commit to scottbilas/PSDepend that referenced this issue Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants