1

Still looking for a way to simply get the current OS version (e.g. OS Version:10.0.14393.0) from a C#/UWP iot-core app. Pointers? If I search the web, I get jumbles of confusing hacks.

The version number for iot-core being very significant, we find statements like this all over the place "This branch supports the lastest windows IoTCore release available ( currently 1607, version number 10.0.14393.x )" And windows 10 UWP devices now do automatic OS updates. So how do I get this information from the device (iot-core/UWP) at runtime?

Note: "Environment.OSVersion.Version" is apparently not available so this is not a duplicate to post How to get OS version number?

Community
  • 1
  • 1
GGleGrand
  • 1,565
  • 1
  • 20
  • 45
  • I've got no way to verify this, but you may want to call the [native `GetVersionEx` function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834(v=vs.85).aspx) via P/Invoke. A quick Google search to confirm whether that's possible to do on UWP led me to [a page that describes how to do exactly that, albeit using a different function as an example](https://mtaulty.com/2016/01/11/windows-10-uwp-and-pinvoke-getnativesysteminfo/). – cynic Aug 14 '16 at 20:53
  • [follow this](http://stackoverflow.com/questions/31783604/windows-10-get-devicefamilyversion) – tao Aug 15 '16 at 02:49
  • Thanks. This ( http://stackoverflow.com/a/31895625/1480500 ) and (http://stackoverflow.com/q/36462824/1480500) seem to provide the desired result but given that it is an analytics API, I guess Microsoft really has decided that we don't need to know this (thus, answer marked below)!? – GGleGrand Aug 17 '16 at 15:53

1 Answers1

2

According to your description, I think what you actually need is ApiInformation class. This class enables you to detect whether a specified member, type, or API contract is present so that you can safely make API calls across a variety of devices. So we do not need to get the current OS version to see if something is supported in the device. The key point here is Detect features, not OS or devices.

The fundamental idea behind adaptive apps is that your app checks for the functionality (or feature) it needs, and only uses it when available. The traditional way of doing this is by checking the OS version and then use those API. With Windows 10, your app can check at runtime, whether a class, method, property, event or API contract is supported by the current operating system. If so, the app can then call the appropriate API.

For more info, please see Dynamically detecting features with API contracts (10 by 10) and also this question, Target code for a specific version of Windows 10, like Build 10586.

Community
  • 1
  • 1
Jay Zuo
  • 15,653
  • 2
  • 25
  • 49
  • Closer and maybe the best approach. However, I need the OS version for things that I test on a standard platform and then "over air update" to a number of iot-core devices. I need to assure that the devices are at the proper baseline. Otherwise, my app must be more of an AI app than anything else :-) – GGleGrand Aug 17 '16 at 14:55