[Ironpython-users] identifying cli implementation

Vilibald Wanca vilibald.wanca at gmail.com
Sun Jan 5 00:39:04 CET 2014


Hi,

> until now, to detect IronPython I have checked sys.platform == 'cli'
> Now I need to distinguish between .net and mono.
> The check candidate is os.name, but is there a better one?

I'd rely on official approach from mono:

http://www.mono-project.com/FAQ:_Technical#How_can_I_detect_if_am_running_in_Mono.3F

How can I detect if am running in Mono?
---------

using System;

class Program {
     static void Main ()
     {
         Type t = Type.GetType ("Mono.Runtime");
         if (t != null)
              Console.WriteLine ("You are running with the Mono VM");
         else
              Console.WriteLine ("You are running something else");
     }
}
------------

Regards,

vilibald


More information about the Ironpython-users mailing list