在Linux(Debian)下安装mono

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/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值