I have an application which runs as a Word add-in. (VSTO).
It runs on many PCs all over the world. In certain cases I need to trouble shoot problems (obviously remotely) and have a reporting mechanism which tells me which Windows OS is running - I use Environment.OSVersion
in .NET. At least it did until Windows 10.
There is an article on MSDN (Targeting your application for Windows) about creating an application manifest which will enable the correct version to be returned.
But my application is a DLL, not an EXE and so won't really accommodate the XML code referred to in that article.
Is there no way to just ask Windows, "What version are you? Really, I won't cry if you admit to the real version".
Or an entry in the registry or something?
You can try
GetVersionEx
Win32 API.https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
Note that Windows 10 in fact is version 6.4. Ver 6.0 is Vista, 6.1 - 7, 6.2 - 8.
WMI is the best way to do this kind of stuff You can use this to retrieve OS informations :
This can fetch the OS details for you.
Returns 6.1.7601 on my W7 system and 10.0.14393 on my Server 2016 system.
No need to add a target manifest.