[Mono-list] Detecting mono at runtime

thierry Baertschiger tibaer at infomaniak.ch
Fri May 30 04:58:11 EDT 2008


Hi

If you run mono only on Unix/Linux, then "ThisIsMono" could be a simple test : 

return Environment.OSVersion.Platform == PlatformID.Unix;

But if you run mono on Windows as well... I don't know.

Thierry


----- Message d'origine -----
De: Zappo <filpolo at tin.it>
Date: Thu, 29 May 2008 01:55:38 -0700 (PDT)
Sujet: [Mono-list]  Detecting mono at runtime
À: mono-list at lists.ximian.com

>
>Hi all,
>
>I'm in the process of porting a .NET app to Mono, but I need it to also
>still compile and run with the standard .NET tools. There are just a couple
>points in the code where I need to do something different in order to make
>the app work with Mono.
>
>I'd like to be able to write something like:
>
>if ( ThisIsMono() )
>   DoMonoCode()
>else
>   DoNormalCode()
>
>What I'm missing is ThisIsMono - is there any way to detect whether the
>application is being run by Mono, without having to import any Mono-related
>library? (The app must still compile and run on a non-Mono machine). I
>dunno, some way to detect the .NET runtime version?
>
>Sorry if the answer is trivial - I'm a Mono noob. ^^ Thanks for any help. :)
>-- 
>View this message in context: http://www.nabble.com/Detecting-mono-at-runtime-tp17530408p17530408.html
>Sent from the Mono - General mailing list archive at Nabble.com.
>
>_______________________________________________
>Mono-list maillist  -  Mono-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>


More information about the Mono-list mailing list