In .NET Standard 2.0, do I have any ways of determining the operating system and architecture on which my library is running ?
I need to know the OS and architecture to determine which version of nodejs to extract and run at run-time.
Edit about comments : I already found the two methods that you offer but, according to the documentation OperatingSystem.Version and Environment.OSVersion supports the following .net version (standard 2.0 isn't included it seems)
edit 2 - not a duplicate : As per my first edit above, my question targets .NET Standard 2.0, not .NET Framework or .NET Core. .NET Standard 2.0 is crossplateform byt this page only lists windows version which is a very good way to know that this cannot match my needs.
After further research and a better understanding of the Environment.OSVersion
property, I now know that this question is, in fact, a duplicate of this one.
What led me to believing it was not is that, since the documentation doesn't show that these properties and methods are available in .NET Standard 2.0 i assume they were not and didn't take the time to try it.
So I simply copy/pasted the code from the second answer and saw that no error was thrown ...