Fix semantic version parsing (#5480)

This commit is contained in:
Travis Plunk
2017-11-16 10:17:31 -08:00
committed by Dongbo Wang
parent 90f455b9ec
commit e2c7e02099
+4 -4
View File
@@ -1088,10 +1088,10 @@ function Get-PackageSemanticVersion
Write-Verbose "Extract the semantic version in the form of major.minor[.build-quality[.revision]] for $Version"
$packageVersionTokens = $Version.Split('.')
if (3 -eq $packageVersionTokens.Count) {
# In case the input is of the form a.b.c, add a '0' at the end for revision field
$packageSemanticVersion = $Version,'0' -join '.'
} elseif (3 -lt $packageVersionTokens.Count) {
if ($packageVersionTokens.Count -eq 3) {
# In case the input is of the form a.b.c, we use the same form
$packageSemanticVersion = $Version
} elseif ($packageVersionTokens.Count -eq 4) {
# We have all the four fields
$packageRevisionTokens = ($packageVersionTokens[3].Split('-'))[0]
if($NuGet.IsPresent)