Skip to content

Split ModuleVersion

gaelcolas edited this page Jul 18, 2024 · 1 revision

Split-ModuleVersion

SYNOPSIS

Parse a SemVer2 Version string.

SYNTAX

Split-ModuleVersion [[-ModuleVersion] <String>] [<CommonParameters>]

DESCRIPTION

This function parses a SemVer (semver.org) version string into an object with the following properties:

  • Version: The version without tag or metadata, as used by folder versioning in PowerShell modules.
  • PreReleaseString: A Publish-Module compliant prerelease tag (see below).
  • ModuleVersion: The Version and Prerelease tag compliant with Publish-Module.

For instance, this is a valid SemVer: 1.15.0-pr0224-0022+Sha.47ae45eb2cfed02b249f239a7c55e5c71b26ab76.Date.2020-01-07 The Metadata is stripped: 1.15.0-pr0224-0022 The Version is 1.15.0. The prerelease tag is -pr0224-0022 However, Publish-Module (or NuGet/PSGallery) does not support such pre-release, so this function only keep the first part -pr0224

EXAMPLES

EXAMPLE 1

Split-ModuleVersion -ModuleVersion '1.15.0-pr0224-0022+Sha.47ae45eb2cfed02b249f239a7c55e5c71b26ab76.Date.2020-01-07'

Version PreReleaseString ModuleVersion

------- ---------------- -------------

1.15.0 pr0224 1.15.0-pr0224

PARAMETERS

-ModuleVersion

Full SemVer version string with (optional) metadata and prerelease tag to be parsed.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
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.

INPUTS

OUTPUTS

System.Management.Automation.PSCustomObject

NOTES

RELATED LINKS

Clone this wiki locally