What should I do in my C # program to determine the correct OS version for Windows 8.1 using .NET Framework 3.5?
My C # program targeting the .NET Framework 3.5 cannot find the correct version for Windows 8.1: 6.2.9200 is returned when 6.3.9600 is correct.
Console.WriteLine(System.Environment.OSVersion.Version); // prints out 6.2.9200
I found this thread What is Windows 8.1 OS version? which mentions a link that is currently broken.
What should I do with the program to get the correct value?
+3
source to share
1 answer
Add app manifest (right click on executable project -> add -> new item ... -> find app manifest file) and uncomment items under compatibility
:
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
</application>
</compatibility>
+3
source to share