0

Is it possible to detect the windows build number of a given device from my app? If so can someone please post a link or tell me how to do it?

I'm trying to deploy a quick workaround for a bug that only affects users on a specific Insider build. Thanks!

RoboLam
  • 488
  • 6
  • 14
  • Did you try examining Environment.OSVersion? –  Jul 25 '16 at 17:05
  • 1
    Environment.OSVersion does not exist in the UWP SDK. I found this though, and it looks like it works on my box: http://stackoverflow.com/a/31895625/2646868 – Adam Venezia Jul 25 '16 at 17:14
  • @AdamVenezia is correct and I just stumbled upon a similar answer as you Adam. Thanks. – RoboLam Jul 25 '16 at 17:16

1 Answers1

2

Found the answer:

string deviceFamilyVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
    ulong version = ulong.Parse(deviceFamilyVersion);
    ulong major = (version & 0xFFFF000000000000L) >> 48;
    ulong minor = (version & 0x0000FFFF00000000L) >> 32;
    ulong build = (version & 0x00000000FFFF0000L) >> 16;
    ulong revision = (version & 0x000000000000FFFFL);
    var osVersion = $"{major}.{minor}.{build}.{revision}";

https://social.msdn.microsoft.com/Forums/en-US/2d8a7dab-1bad-4405-b70d-768e4cb2af96/uwp-get-os-version-in-an-uwp-app?forum=wpdevelop

RoboLam
  • 488
  • 6
  • 14