The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[UWP] Get OS version in an UWP app? RRS feed

  • Question

  • Could anyone tell me how to get OS version in UWP? in Windows Phone, it can be done by using Environment.OSVersion.

    Thanks


    • Edited by Fred Bao Wednesday, December 30, 2015 3:14 AM add the tag
    Sunday, December 27, 2015 9:10 AM

Answers

  • Hi,

    The following code may help you:

    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}";
    Regards

    • Marked as answer by MartinJ86 Sunday, December 27, 2015 9:42 AM
    Sunday, December 27, 2015 9:12 AM