I am developing .NET 4 WPF application and this application should be able to export data to Excel xls worksheet. However I need to resolve at runtime which version it is running on since there are still computers with Windows XP and Office 97/2000 on them.
I wasn't able to export xls trough my application on Windows XP, Office 97/2000 because we don't own Office Interop libraries, versions 7, 8, or 9.
Therefore I will export to CSV on Windows XP and xls on Windows 7 and Windows 10.
I tried this code snippet but I am unsure if it is enough info to recognize if it is Win XP, 7 or 10.
public static string getOSVersion()
{
return Environment.OSVersion.ToString() + ", " + Environment.Version;
}
I am getting this on Windows 10:
Microsoft Windows NT 6.2.9200.0, 4.0.30319.42000
Is this enough information or is there a better way to recognize Windows OS Name?