在Linux(Debian)下安装mono

类别:.NET开发 点击:0 评论:0 推荐:

Debian是诸多Linux发行版之一。MONO是.net在Linux下的移值版,通过Debian的apt-get可方便的安装MONO

1.首先在 /etc/apt/sources.list 內加上:

deb http://pkg-mono.alioth.debian.org/current ./
deb-src http://pkg-mono.alioth.debian.org/current ./

2.更新现有包:
apt-get update

3.安装
apt-get install mono

安装需要40M空间,如果要更新依赖包,将需要更多空间

第一个Linux下的.net程序:

debian:~# cat > hello.cs
using System;
 
class Hello {
    static void Main() {
        Console.WriteLine ("Hello, World!");
    }
}


debian:~#  mcs /target:exe hello.cs
Compilation succeeded

debian:~# ./hello.exe
Hello, World!

将该程序复制到windows下,可以直接执行。

第一个windows下的.net程序

c:\csc helloWin.cs
将生成helloWin.exe,该程序可以Windows下执行。

将该程序COPY到Linux下,因为linux下的可执行程序必须要用可执行的属性,通过:

chmod u=rwx helloWin.exe

赋于可执行属性。

debian:~# ./helloWin.exe
Hello, World!


可成功运行。

通过MONO,Windows下的.net程序可直接运行在Linux下,Linux下生成的.net程序也可直接运行在Windows下,真的很COOL。

由于我在VMWARE中装的Linux,所以不知道在VMWare中怎么访问HOST机中WindowsXP下的文件,有知道的朋友,请告之。Debian下好像有一个直接从网站下载文件的程序,有知道的朋友,也吱一声.


相关网站:

MONO在Debian下的发行版
http://pkg-mono.alioth.debian.org/

MONO的老巢,其中有各个平台的MONO发行版:
http://www.go-mono.org/

本文地址:http://com.8s8s.com/it/it43766.htm