简体   繁体   English

我应该在C#程序中使用.NET Framework 3.5检测Windows 8.1的正确操作系统版本?

[英]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.

相关问题 我应该使用类库来定位.NET Framework和C#版本? - What .NET Framework and C# version should I target with my class library? 如何在我的C#XAML Windows 8.1应用程序中使我的TextBlocks成为正确的大小? - How do I make my TextBlocks be the correct sizes in my C# XAML Windows 8.1 app? 我需要使用.NET 4和C#开发什么版本的Windows? - What version of windows do I need to develop with .NET 4 and C#? 我应该添加什么项目文件来部署.NET3.5 Windows应用程序? - What files of my project should I add for deploying my .NET3.5 windows app? 学习C#,ASP.NET 3.5 - 我应该学习什么顺序/要跳过什么? - Learning C#, ASP.NET 3.5 - what order should I learn in / what to skip? C#.Net Compact Framework 3.5 FtpWebRequest Windows Mobile 6 - C# .Net Compact Framework 3.5 FtpWebRequest Windows Mobile 6 .NET Framework 4桌面应用程序[C#]是否将运行Windows 8、8.1和10 - Will .NET Framework 4 desktop application [C#] run Windows 8, 8.1 and 10 检测框架版本3.5 - Detect framework version 3.5 我要向我的 windows forms C# 程序添加什么错误消息? - What error messaging do i add to my windows forms C# program? 如何使用.NET Framework 3.5中的数据注释对C#类进行属性验证? - How does one do property validation of a C# class using Data Annotations in .NET Framework 3.5?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM