From 83128960855a9c9a4448b08094348415c1deac83 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Fri, 6 Aug 2021 08:40:11 -0700 Subject: [PATCH] Fix Msi version string generation Based on operator precedence, `0x3FFF << 4` was happening first, ensuring that we always cut off the lower 4 bits of the build number when generating an Msi version. The good news appears to be that the Major and Minor stay the same or go up, though the patch value will go down. Before: A build number major value of 30327 or 30328 and build number value of 9 would generate `48.0.30329` After: `48.3.26489` and `48.3.26505`, respectively. --- .../src/GenerateMsiVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs b/src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs index 95ba0420bff..f0603ca7ad5 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Installers/src/GenerateMsiVersion.cs @@ -85,7 +85,7 @@ private void ParseBuildNumberMajorMinor() var minor = int.Parse(Minor) << 22; var patch = int.Parse(Patch) << 18; - var buildNumberMajor = int.Parse(BuildNumberMajor) & 0x3FFF << 4; + var buildNumberMajor = (int.Parse(BuildNumberMajor) & 0x3FFF) << 4; var buildNumberMinor = int.Parse(BuildNumberMinor) & 0xF; var msiVersionNumber = major | minor | patch | buildNumberMajor | buildNumberMinor;