ConvertTo-UssSemanticVersion
SYNOPSIS
Converts an input to semantic version type.
SYNTAX
ConvertTo-UssSemanticVersion [-Version] <SemanticVersion> [<CommonParameters>]
DESCRIPTION
Converts the input to a type of semantic version. Can be useful to compare and sort versions.
EXAMPLES
Example 1
PS C:\> (ConvertTo-UssSemanticVersion '1.0') -gt (ConvertTo-UssSemanticVersion '1.0-beta')
True
This example compares if version 1.0 is greater than 1.0-beta and returns $true.
Example 2
PS C:\> $Versions = '1.0-beta', '2.0-rc', '1.0', '1.0-rc', '2.0'
PS C:\> $Versions | ConvertTo-UssSemanticVersion | Sort-Object | ForEach-Object { $_.ToString() }
1.0-beta
1.0-rc
1.0
2.0-rc
2.0
This example converts a list of version numbers to a semantic version and sorts the list.
PARAMETERS
-Version
Specifies a version on semantic version form to be converted.
Type: SemanticVersion
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.