In windows 8.1 Environment.OSVersion underlying Win32 GetVersionEx function changed to for compatibility reasons report latest version app is compiled for.
Console.WriteLine(
System.Environment.OSVersion
);
- Without 8.1 ID on 8.1
- Microsoft Windows NT 6.2.9200.0
- Without 10 ID on 10
- Microsoft Windows NT 6.3.9600.0
- With 10 ID on 10
- Microsoft Windows NT 10.0.10049.0
If you have an app.manifest just add the <supportedOS Id/>
you are missing.
Otherwise just Add new item to the project, search for manifest and choose Application Manifest File
with file name app.manifest
Basically your .csproj
should include (should just work if you add an Application Manifest File
with file name app.manifest
)
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
and
<ItemGroup>
<None Include="app.manifest" />
</ItemGroup>
not having
it might be helpful to query for the actual version using API/WMI:supportedOS
will run your app in vista virtualization mode.wmic os get Caption, Version, BuildNumber, OSArchitecture
(example)WMI should always get you an accurate acknowledgment. regardless (compatibility?) mode your app runs at. either parse the output of
wmic
or use proper objects and WMI API.