From 8629b7aa346c2b3f4dcfe660c7fa4766a222a819 Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Thu, 10 Dec 2020 16:14:05 -0800 Subject: [PATCH] Update how BuildNumbers are calculated (#2125) * Update _GlobalStaticVersion.props Change to the way we calculate the build number. Formerly, we calculated builds as the TotalMinutes between DateTime.Now and the semantic version time stamp, divided by 5. This meant that every 5 minutes the build number changes. This was hurting nightly nupkgs because our assembly version and packages weren't matching. This PR changes the calculation to be TotalHours / 12. * Update release_NupkgAudit.ps1 --- .props/_GlobalStaticVersion.props | 15 +++++++++------ .scripts/release_NupkgAudit.ps1 | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.props/_GlobalStaticVersion.props b/.props/_GlobalStaticVersion.props index 90d44e15a5..55f97cf80e 100644 --- a/.props/_GlobalStaticVersion.props +++ b/.props/_GlobalStaticVersion.props @@ -11,9 +11,9 @@ Update for every public release. --> 2 - 16 + 17 0 - + beta1 nightly - 2020-09-08 + 2020-12-01 - $([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0')) + $([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalHours), 12)) + $([System.Math]::Floor($(BuildNumberHours)).ToString('F0').PadLeft(5, '0')) $(SemanticVersionMajor).$(SemanticVersionMinor).$(SemanticVersionPatch) $(PreReleaseMilestone) diff --git a/.scripts/release_NupkgAudit.ps1 b/.scripts/release_NupkgAudit.ps1 index 7e87658a1e..3fb53b4dd9 100644 --- a/.scripts/release_NupkgAudit.ps1 +++ b/.scripts/release_NupkgAudit.ps1 @@ -181,7 +181,7 @@ function Get-DoesDllVersionsMatch ([string]$dllPath) { $message = "File Version: '$fileVersion' Assembly Version: '$assemblyVersion"; $requirement = "Versions should match." - Test-Condition ($fileVersion.Equals($assemblyVersion)) $message $requirement; + Test-Condition ([version]$fileVersion -eq [version]$assemblyVersion) $message $requirement; } function Get-IsValidPackageId([xml]$nuspecXml) {