[Mono-list] Re: Determine the name and/or kind of CLI runtimeenvironment

Robert Jordan robertj at gmx.net
Mon May 30 10:22:02 EDT 2005


Kornél,

>> isMono =
>>   (int)Environment.OSVersion.Platform == 128 ||  // Fw 1.1
>>   (int)Environment.OSVersion.Platform == 4;      // Fw 2.0
>>
>> I don't know how DotGNU can be detected.
> 
> 
> Thanks, but this not what I want to detect. This detects the Operating
> System.
> But I want to detect the type of CLI (.NET Framework/Mono/Portable.NET)

There is no "official" way to detect the CLRs.

You may try to instantiate a type that only exists
on Mono (i.e. one from the Mono.* namespaces). However, most
of those types might run with MSFT runtime as well ...

I've already seen such code in one of Mono's test cases,
but I cannot recall where.

Another way might be to call some unimplemented
System.Runtime.InteropServices.Marshal methods.
That's what I'm doing.

Rob



More information about the Mono-list mailing list