Inconsistencies with RuntimeInformation OS checks when using mkbundle

39 Views Asked by At

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?

0

There are 0 best solutions below