5

I have an app which works on Linux and Windows. I need to know where the app is working for use difference code. Thanks

Serhii Shemshur
  • 1,273
  • 3
  • 15
  • 21
  • 2
    try to use `RuntimeInformation` from `System.Runtime.InteropServices`: `RuntimeInformation.IsOSPlatform(OSPlatform.Linux)` or `RuntimeInformation.IsOSPlatform(OSPlatform.Windows)` or `RuntimeInformation.IsOSPlatform(OSPlatform.OSX)` – Oleg Aug 29 '16 at 13:40
  • 1
    See my [detailed answer in other thread](http://stackoverflow.com/a/38795621/3325704) – jariq Aug 29 '16 at 20:40

1 Answers1

5

You are probably looking for System.Runtime.InteropServices.RuntimeInformation with the IsOsPlatform function to do runtime checks.

Have look at the video tutorial https://channel9.msdn.com/Series/aspnetmonsters/ASPNET-Monsters-Episode-46-Finding-Platform-Information of the ASP.NET Monsters.

Ralf Bönning
  • 14,515
  • 5
  • 49
  • 67