程序员人生 网站导航

Ubuntu Server 9.10 安装 Mono 2.4 运行环境

栏目:服务器时间:2014-02-27 17:37:00
$ sudo apt-get install mono-gmcs libmono-system-data2.0-cil libmono-system-messaging2.0-cil libmono-system-ldap2.0-cil libmono-system-messaging2.0-cil libmono-system-runtime2.0-cil libmono-system-web2.0-cil libmono-system-web-mvc1.0-cil libmono-wcf3.0-cil libmono-winforms2.0-cil

可选:
libmono-oracle2.0-cil libmono-npgsql2.0-cil libmono-nunit2.4-cil libmono-sharpzip2.84-cil libmono-sqlite2.0-cil

安装信息:
0 upgraded, 82 newly installed, 0 to remove and 37 not upgraded.
Need to get 21.8MB of archives.
After this operation, 81.7MB of additional disk space will be used.
Do you want to continue [Y/n]?
... ...

查看相关信息:

$ mono -V
Mono JIT compiler version 2.4.2.3 (Debian 2.4.2.3+dfsg-2)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC)
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none

$ gmcs --help
Mono C# compiler, Copyright 2001 - 2008 Novell, Inc.
mcs [options] source-files
--about About the Mono C# compiler
-addmodule:M1[,Mn] Adds the module to the generated assembly
-checked[+|-] Sets default aritmetic overflow context
-codepage:ID Sets code page to the one in ID (number, utf8, reset)
-clscheck[+|-] Disables CLS Compliance verifications
-define:S1[;S2] Defines one or more conditional symbols (short: -d)
-debug[+|-], -g Generate debugging information
-delaysign[+|-] Only insert the public key into the assembly (no signing)
-doc:FILE Process documentation comments to XML file
-help Lists all compiler options (short: -?)
-keycontainer:NAME The key pair container used to sign the output assembly
-keyfile:FILE The key file used to strongname the ouput assembly
-langversion:TEXT Specifies language version modes: ISO-1, ISO-2, or Default
-lib:PATH1[,PATHn] Specifies the location of referenced assemblies
-main:CLASS Specifies the class with the Main method (short: -m)
-noconfig Disables implicitly referenced assemblies
-nostdlib[+|-] Does not reference mscorlib.dll library
-nowarn:W1[,Wn] Suppress one or more compiler warnings
-optimize[+|-] Enables advanced compiler optimizations (short: -o)
-out:FILE Specifies output assembly name
-pkg:P1[,Pn] References packages P1..Pn
-recurse:SPEC Recursively compiles files according to SPEC pattern
-reference:A1[,An] Imports metadata from the specified assembly (short: -r)
-reference:ALIAS=A Imports metadata using specified extern alias (short: -r)
-target:KIND Specifies the format of the output assembly (short: -t)
KIND can be one of: exe, winexe, library, module
-unsafe[+|-] Allows to compile code which uses unsafe keyword
-warnaserror[+|-] Treats all warnings as errors
-warnaserror:W1[,Wn] Treats one or more compiler warnings as errors
-warn:0-4 Sets warning level, the default is 4 (short -w:)
-help2 Shows internal compiler options

Resources:
-linkresource:FILE[,ID] Links FILE as a resource (short: -linkres)
-resource:FILE[,ID] Embed FILE as a resource (short: -res)
-win32res:FILE Specifies Win32 resource file (.res)
-win32icon:FILE Use this icon for the output
@file Read response file for more options

Options can be of the form -option or /option

$ ls -1 /usr/lib/mono/2.0
Accessibility.dll
CustomMarshalers.dll
gacutil.exe
gmcs.exe
gmcs.exe.config
I18N.dll
I18N.West.dll
ICSharpCode.SharpZipLib.dll
Mono.CompilerServices.SymbolWriter.dll
Mono.Data.SqliteClient.dll
Mono.Data.Sqlite.dll
Mono.Data.Tds.dll
Mono.Http.dll
Mono.Messaging.dll
Mono.Posix.dll
Mono.Security.dll
Mono.WebBrowser.dll
Mono.Web.dll
mscorlib.dll
Novell.Directory.Ldap.dll
OpenSystem.C.dll
System.ComponentModel.DataAnnotations.dll
System.Configuration.dll
System.Configuration.Install.dll
System.Core.dll
System.Data.DataSetExtensions.dll
System.Data.dll
System.Data.Linq.dll
System.Design.dll
System.DirectoryServices.dll
System.dll
System.Drawing.Design.dll
System.Drawing.dll
System.EnterpriseServices.dll
System.IdentityModel.dll
System.IdentityModel.Selectors.dll
System.Management.dll
System.Messaging.dll
System.Runtime.Remoting.dll
System.Runtime.Serialization.dll
System.Runtime.Serialization.Formatters.Soap.dll
System.Security.dll
System.ServiceModel.dll
System.ServiceModel.Web.dll
System.ServiceProcess.dll
System.Transactions.dll
System.Web.Abstractions.dll
System.Web.dll
System.Web.DynamicData.dll
System.Web.Extensions.Design.dll
System.Web.Extensions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
System.Web.Services.dll
System.Windows.Forms.dll
System.Xml.dll
System.Xml.Linq.dll

写个 C# 3 程序测试一下:

$ vim test.cs
using System;
using System.Linq;

namespace Learn.CUI
{
class Program
{
static void Main()
{
var users = new[] { new { Name = "ZhangSan", Age = 30 }, new { Name = "LiSi", Age = 25 } };
var q = from u in users where u.Age > 26 select u.Name;

foreach (var item in q)
{
Console.WriteLine(item);
}

Console.WriteLine("Press any key to exit...");
Console.ReadKey(true);
Environment.Exit(0);
}
}
}

$ gmcs test.cs

$ ls
test.cs test.exe

$ ./test.exe
ZhangSan
Press any key to exit...
------分隔线----------------------------
------分隔线----------------------------

最新技术推荐