[Mono-list] Re: [Mono-devel-list] Determine the name and/or kind of
CLI runtime environment
bmaurer at ximian.com
Tue May 31 00:17:50 EDT 2005
On Mon, 2005-05-30 at 10:31 +0200, Kornél Pál wrote:
> Is there any official or unofficial but working way to determine what kind
> of CLI runtime environment is executing the assembly?
> There are at least three of them:
> -Microsoft .NET Framework
> -DotGNU Portable.NET
> They have different interfaces to low level runtime functionality and it is
> good if an error report contains the name of the CLI runtime as well.
> What do you recommend on detecting Mono from managed code?
The name of the runtime alone isn't that useful. You'd probably want the
version of Mono as well.
Probably the best way to do this is to test if `basedir typeof
(object).Assembly.Location`/mcs.exe is there (using c# + bash :-), and
if it is to execute that with --version. (I guess you need to test for
gmcs.exe too, since that is what will be there for 2.0...)
If you want a simpler test, being able to load Mono.Posix via reflection
would be a pretty good one. Much better than depending on an internal
type like MonoType...
More information about the Mono-list