How to get Windows Version and dotnet version info (OSInfo)
Hello everyone,
I want to log the current Windows version and the latest .NET runtime that is installed in every test in a "version.txt" file
The OSInfo.Version only shows "10.0 Build 19045" and OSInfo.ServicePackVersion is empty. What I want is something like "Windows 10 22H2".
Also Sys.OSInfo.NetCoreVersion(Sys.OSInfo.NetCoreCount -1) shows v4.0.30319 instead of 7.0.0
Maybe somebody can help me 🙂
Best regards
Windows naming convention has changed, see https://en.wikipedia.org/wiki/Windows_10_version_history. You will have to write a function to convert the build number i.e. 19044 to "21H2", which then refers to the cumulative update, November 2021 Update.
You can get this information also, using PowerShell script, which you can then output to a file