How to determine the revision from which current M

2019-05-23 00:41发布

I want to determine the revision (how to call properly it in Git?) from which current Mono runtime was built and installed.

$ dmcs --version
Mono C# compiler version 2.9.0.0

but it's definitely insufficient.

XSP/ASP.NET error page gives more information:

Version information: Mono Runtime Version: 2.8.1 (master/cdf1247 Sat Sep 4 01:22:04 MSD 2010); ASP.NET Version: 4.0.30319.1

but it seems to be a dirty hack to me.

How to do it properly?

标签: mono version
2条回答
甜甜的少女心
2楼-- · 2019-05-23 01:25

If you're looking for the mono runtime version; there is an internal Mono.Runtime class in mscorlib, it has a static method GetDisplayName which should return a string with current runtime version. This method is private but still can be accessed via reflection. I wrote a small script to test this, check if would work for you:

Type type = Type.GetType("Mono.Runtime");
if (type != null)
{                                          
    MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); 
    if (dispalayName != null)                   
        Console.WriteLine(dispalayName.Invoke(null, null)); 
}

on my system this returns:

2.6.7 (Debian 2.6.7-3ubuntu1~dhx1)

hope this helps, regards

查看更多
Deceive 欺骗
3楼-- · 2019-05-23 01:35

mono -V will output the version string, including source code revision.

查看更多
登录 后发表回答