Using windows 10, upgraded from windows 8 => 8.1 => 10 When I use this code.
OperatingSystem os = System.Environment.OSVersion;
The os.Version = {6.2.9200.0} System.Version
I read this was because of the version it was manifested for but I do not understand what that means.
I want the correct OS version because I am logging a user agent string on a web service, and want to correctly identify the windows version for support. what is the easiest way to get that to correctly report the correct version?
Windows 10 returns that string unless you declare that your application is compatible using a manifest. To do so add an app.manifest
(right click your project -> Add -> New Item -> Application Manifest File) then uncomment the following line:
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
You can do the same thing for Windows Vista to Windows 10. All are in the same section:
<application> <!-- A list of the Windows versions that this application has been tested on and is is designed to work with. Uncomment the appropriate elements and Windows will automatically selected the most compatible environment. --> <!-- Windows Vista --> <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> <!-- Windows 7 --> <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> <!-- Windows 8 --> <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> <!-- Windows 8.1 --> <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> </application>
And now when you run your application it'll report the correct 10.0.*.0 version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With