< Back
Compare-SemVerVersion
Post
NAME Compare-SemVerVersion
SYNOPSIS
Compares two versions and find whether they're equal, or one is newer than the other.
SYNTAX
Compare-SemVerVersion [-ReferenceVersion] <String> [[-DifferenceVersion] <String>] [<CommonParameters>]
DESCRIPTION
The Compare-SemVerVersion allows the comparison of SemVer 2.0 versions (including prerelease identifiers)
as documented on semver.org
The result will be = if the versions are equivalent, > if the reference version takes precedence, or < if the
difference version wins.
PARAMETERS
-ReferenceVersion <String>
The string version you would like to test.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DifferenceVersion <String>
The other string version you would like to compare agains the reference.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
Worth noting that the documentaion of SemVer versions should follow this logic (from semver.org)
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 <
1.0.0.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion
'0.2.3.546-alpha.200'
# >
Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion '0.2.3.546-alpha.202'
# <
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion
'0.2.3.546-alpha.201+01012015'
# =
RELATED LINKS
SYNOPSIS
Compares two versions and find whether they're equal, or one is newer than the other.
SYNTAX
Compare-SemVerVersion [-ReferenceVersion] <String> [[-DifferenceVersion] <String>] [<CommonParameters>]
DESCRIPTION
The Compare-SemVerVersion allows the comparison of SemVer 2.0 versions (including prerelease identifiers)
as documented on semver.org
The result will be = if the versions are equivalent, > if the reference version takes precedence, or < if the
difference version wins.
PARAMETERS
-ReferenceVersion <String>
The string version you would like to test.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DifferenceVersion <String>
The other string version you would like to compare agains the reference.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
System.String
NOTES
Worth noting that the documentaion of SemVer versions should follow this logic (from semver.org)
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 <
1.0.0.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion
'0.2.3.546-alpha.200'
# >
Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion '0.2.3.546-alpha.202'
# <
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Compare-SemVerVersion -ReferenceVersion '0.2.3.546-alpha.201+01012018' -DifferenceVersion
'0.2.3.546-alpha.201+01012015'
# =
RELATED LINKS