[英]What should I do in my C# program to detect the correct OS version for Windows 8.1, using .NET Framework 3.5?
My C# program, targeting .NET Framework 3.5 is unable to detect the correct version for Windows 8.1 OS: 6.2.9200 is returned when 6.3.9600 is the correct value. 针对.NET Framework 3.5的我的C#程序无法检测到Windows 8.1操作系统的正确版本:当6.3.9600是正确值时,将返回6.2.9200。
Console.WriteLine(System.Environment.OSVersion.Version); // prints out 6.2.9200
I found this thread What is the OS version for Windows 8.1? 我找到了这个帖子什么是Windows 8.1的操作系统版本? which mentions a link that is currently broken.
提到了一个目前被打破的链接。
What should I do to the program to obtain the correct value? 我该怎么做才能获得正确的价值?
Add custom application manifest (right click executable project -> add -> new item... -> find application manifest file) and uncomment elements in its compatibility
section: 添加自定义应用程序清单(右键单击可执行项目 - >添加 - >新项目... - >查找应用程序清单文件)并在其
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.