diff --git a/AU/Private/AUVersion.ps1 b/AU/Private/AUVersion.ps1 index 7b33bf42..ba57070d 100644 --- a/AU/Private/AUVersion.ps1 +++ b/AU/Private/AUVersion.ps1 @@ -53,6 +53,8 @@ class AUVersion : System.IComparable { } } + [AUVersion] WithVersion([version] $version) { return [AUVersion]::new($version, $this.Prerelease, $this.BuildMetadata) } + [int] CompareTo($obj) { if ($obj -eq $null) { return 1 } if ($obj -isnot [AUVersion]) { throw "AUVersion expected: $($obj.GetType())" } diff --git a/AU/Public/Update-Package.ps1 b/AU/Public/Update-Package.ps1 index f008c69e..5a3a3766 100644 --- a/AU/Public/Update-Package.ps1 +++ b/AU/Public/Update-Package.ps1 @@ -284,7 +284,7 @@ function Update-Package { $build = if ($v.Build -eq -1) {0} else {$v.Build} $v = [version] ('{0}.{1}.{2}.{3}' -f $v.Major, $v.Minor, $build, $d) - $package.RemoteVersion = [AUVersion]::new($v, $nuspecVersion.Prerelease, $nuspecVersion.BuildMetadata).ToString() + $package.RemoteVersion = $nuspecVersion.WithVersion($v).ToString() $Latest.Version = $package.RemoteVersion -as $Latest.Version.GetType() }