Code if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {//Linux } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {//Windows } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {//OSX }