System.Environment.OSVersion returns wrong version

后端 未结 3 583
旧巷少年郎
旧巷少年郎 2020-12-30 20:41

Using windows 10, upgraded from windows 8 => 8.1 => 10 When I use this code.

OperatingSystem os = System.Environment.OSVersion;

The os.Vers

3条回答
  •  余生分开走
    2020-12-30 21:34

    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:

    
    

    You can do the same thing for Windows Vista to Windows 10. All are in the same section:

    
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
      
    
    
    

    And now when you run your application it'll report the correct 10.0.*.0 version

提交回复
热议问题