如何在C#中获取已安装的OS版本号
How to get the installed OS version number in C#
仍在寻找一种方法来简单地从 C#/UWP iot-core 应用程序获取当前 OS 版本(例如 OS Version:10.0.14393.0)。指针?如果我在网上搜索,我会得到一堆令人困惑的黑客。
iot-core 的版本号非常重要,我们发现到处都是这样的语句 "This branch supports the lastest windows IoTCore release available ( currently 1607, version number 10.0.14393.x )" 并且 windows 10 个 UWP 设备现在执行自动 OS 更新。那么如何在运行时从设备 (iot-core/UWP) 获取这些信息呢?
注意:“Environment.OSVersion.Version”显然不可用,因此这与 post How to get OS version number?
不重复
根据你的描述,我想你真正需要的是ApiInformation class。此 class 使您能够检测指定的成员、类型或 API 合同是否存在,以便您可以安全地跨各种设备进行 API 调用。所以我们不需要获取当前的 OS 版本来查看设备是否支持某些内容。这里的关键点是检测功能,而不是OS或设备。
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.
更多信息,请参阅Dynamically detecting features with API contracts (10 by 10) and also this question, 。
仍在寻找一种方法来简单地从 C#/UWP iot-core 应用程序获取当前 OS 版本(例如 OS Version:10.0.14393.0)。指针?如果我在网上搜索,我会得到一堆令人困惑的黑客。
iot-core 的版本号非常重要,我们发现到处都是这样的语句 "This branch supports the lastest windows IoTCore release available ( currently 1607, version number 10.0.14393.x )" 并且 windows 10 个 UWP 设备现在执行自动 OS 更新。那么如何在运行时从设备 (iot-core/UWP) 获取这些信息呢?
注意:“Environment.OSVersion.Version”显然不可用,因此这与 post How to get OS version number?
不重复根据你的描述,我想你真正需要的是ApiInformation class。此 class 使您能够检测指定的成员、类型或 API 合同是否存在,以便您可以安全地跨各种设备进行 API 调用。所以我们不需要获取当前的 OS 版本来查看设备是否支持某些内容。这里的关键点是检测功能,而不是OS或设备。
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.
更多信息,请参阅Dynamically detecting features with API contracts (10 by 10) and also this question,