[Mono-devel-list] Determine the name and/or kind of CLIruntimeenvironment

Kornél Pál kornelpal at hotmail.com
Wed Jun 1 12:17:40 EDT 2005


> From: "Jonathan Gilbert" <2a5gjx302 at sneakemail.com>
> string version_string =
> AppDomain.Current.GetData("__MONO_RUNTIME_VERSION").ToString();
>
>I could probably hack up a patch to do something like this. Can anyone
>think of any strong reason to not do this?

The reason to get runtime version is to display or log it. It can be usefult
in error logs/reports generated by an application or for example if you are
using Mono to run ASP.NET applications on a remote server you have no idea
about the version of the runtime.

There is no "official" way to determine the type or the name of the runtime
but it can be done using some hacks discussed on the list it this thread.

System.Environment.Version returns the real version (including real revision
number) of the runtime on .NET Framework.
Portable.NET returns its the real version number of it's own runtime.
For some unknown (I think for compatibility considerations) Mono returns
some fake version numbers taken from the RTM versions of .NET Framework.

.NET Framework SDK Documentation specifies this property as the following:
"Gets a Version object that describes the major, minor, build, and revision
numbers of the common language runtime."

So I think this propery should return the real version of the Mono runtime
instead of some fake numbers.

As using the version number to determine the feature set of the runtime or
class library is a wrong practicle. And as each runtime has its own feature
set if someone uses this property to determine the feature set of .NET
Framework runtime his code will not be compatible with Mono even if Mono
uses the same version numbers in this propery as it has different feature
set. So it is useless to return fake version numbers.

Kornél




More information about the Mono-devel-list mailing list