0

I'm using RuntimeInformation.IsOSVersion(OSPlatform.Linux) to detect whether the operating system that the application is being run on is Linux or not.

When simply building a .exe using Mono (Ubuntu Xenial), and running it with mono example.exe, calling it returns true, as it should. However, when using mkbundle to make a native Linux executable, and calling it with ./example, calling it returns false. Below is an example of the code I'm using:

if (RuntimeInformation.IsOSVersion(OSPlatform.Linux))
{
    //do some linux specific stuff
}
else
{
    //do some windows specific stuff
}

Is there any way I can fix this issue, or more reliably detect the OS the program is being run on?

Larry Tang
  • 642
  • 5
  • 23

0 Answers0