在 Ubuntu 10.10 操作系统中安装 Mono 2.8.2(2)

安装完毕后,可以添加一些快捷的命令:

ben@ben-m4000t:~$ cd bin ben@ben-m4000t:~/bin$ cat dmcs exec /opt/mono-2.8.2/bin/dmcs "$@" ben@ben-m4000t:~/bin$ cat mono28 exec /opt/mono-2.8.2/bin/mono "$@"

上面的意思是说使用你自己喜欢的编辑器,比如 vim,或者 gedit,在 $HOME/bin 目录下建立快捷命令,以方便使用。命令的内容就如上所示。mono28 命令用来运行“Mono 2.8.2 运行时”本身,dmcs 用来运行 Mono 2.8.2 的 C# 4.0 编译器。注意 Mono 2.6.7 的 C# 编译器是 gmcs,而没有 dmcs,所以就不用写成 dmcs28 了。Mono 2.8.2 也有 C# 2.0 编译器,也叫 gmcs,如果需要的话,直接用 /opt/mono-2.8.2/bin/gmcs 运行好了。

验证安装结果

试运行一下:

ben@ben-m4000t:~$ mono28 --version Mono JIT compiler version 2.8.2 (tarball 2011年 01月 07日 星期五 10:52:34 CST) Copyright (C) 2002-2010 Novell, Inc and Contributors. TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: debugger softdebug LLVM: supported, not enabled. GC: Included Boehm (with typed GC and Parallel Mark) ben@ben-m4000t:~$ dmcs --version Mono C# compiler version 2.8.2.0 ben@ben-m4000t:~$ /opt/mono-2.8.2/bin/gmcs --version Mono C# compiler version 2.8.2.0

检查一下 Ubuntu 10.10 自带的 mono 2.6.7:

ben@ben-m4000t:~$ mono --version Mono JIT compiler version 2.6.7 (Debian 2.6.7-3ubuntu1) Copyright (C) 2002-2010 Novell, Inc and Contributors. TLS: __thread GC: Included Boehm (with typed GC and Parallel Mark) SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none ben@ben-m4000t:~$ gmcs --version Mono C# compiler version 2.6.7.0

原来的 mono 并没有被我们破坏。

实际应用

让我们使用刚安装好的 Mono 2.8.2 来编译和运行一个 C# 程序吧:

ben@ben-m4000t:~/work/AboutDialog$ dmcs @mak.rsp ben@ben-m4000t:~/work/AboutDialog$ mono28 AboutDialogTester.exe

在 Ubuntu 10.10 操作系统中安装 Mono 2.8.2

从上图可以看出,Mono 2.8.2 的运行环境是 CLR 4.0.30319.1,这和 Microsoft .NET Framework 4 RTM 的 CLR 版本是一致的。对了,这个 WinForm 程序的全部源代码可以在 通用的“关于本软件”对话框 中找到。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyzzxd.html