System.Environment.OSVersion returns wrong version

后端 未结 3 578
旧巷少年郎
旧巷少年郎 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:15

    The sequence of steps given by Nasreddine will add a manifest file, into your project.

    There is another way to add a manifest. Right click project > properties > Application tab > View Windows Settings This will bring up the default manifest, which you can edit. I am using visual studio 2010 Express. From other reading the method should be similar.

    For a project that uses non-windows components (I program in ESRI arc-objcets with VB.Net) there seems to be no way of adding a manifest file. The View Windows Settings button is disabled. The steps given by Nasreddine do add a Manifest file which can be edited but this cannot be incorporated into the project. I have tried many tricks: like adding as a resource (embedded and not embedded), adding it the obj > debug folder.

    The kicker test was I set up a pure windows project, got a windo button comand to return the correct version string (after adding a manifest) then tried to add an non-windows component (ESRI Addin). this failed with an error message.

    I am was just trying to identify the OS because the file location of required files is dependent on operating system. Hope this save others from going down this rabbit hole.

提交回复
热议问题