Search code examples
c#operating-systemwindows-8microsoft-metrowindows-runtime

Get OS-Version in WinRT Metro App C#


I'm programming a Metro Style App with C# and the Visual Studio 11 Beta. Now I want to get the OS-Version of the OS. How can I get this?

I found out how to do it in "normal" Applications. There you take the Environment-Class with the attribute OSVersion but in .NET Core there isn't this attribute


Solution

  • For new applications you should check for specific features, not OS version.

    As far as I can tell there is no reason to check for OS version as metro applications are only available for win 8.

    Edit: Store applications are available on multiple Windows versions now but it is still recommended to test for features instead of OS versions. Minimum OS version is set as the build target for a project when you create it.

    Edit #2: If you are interested in tracking OS versions in your application's install base you can integrate Application Insights into your project starting with applications targeted at Windows 8.1. Here's a howto on getting started with it:

    http://azure.microsoft.com/en-us/documentation/articles/app-insights-windows-get-started/