Skip to content

[SemanticVersion] comparison with [Version] constructed with just major+minor #3786

@nightroman

Description

@nightroman

Tried packages:

  • PowerShell-6.0.0-beta.1-win10-win2016-x64.zip
  • PowerShell-6.0.0-beta.1-win81-win2012r2-x64.zip

This issue might be related to #3696

As far as I understand, expressions $psversiontable.psversion -gt "3.0" were fixed.

But the similar expressions $psversiontable.psversion -gt ([version]"3.0") do not work:

Could not compare "6.0.0-beta" to "3.0". Error: "Cannot convert value "3.0" to type
"System.Management.Automation.SemanticVersion". Error: "Cannot process argument because the value of argument
"version" is not valid. Change the value of the "version" argument and run the operation again.""
At line:1 char:1
+ $psversiontable.psversion -gt ([version]"3.0")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : ComparisonFailure

In other words, [SemanticVersion] comparison with [Version] constructed with just major+minor does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions