您的位置:首页 > 编程语言 > C#

C#的编译

2015-08-25 14:18 603 查看
Windows上的编译

1:先将C:\Windows\Microsoft.NET\Framework\v3.5配置到系统环境变量的path里。

2:写C#代码

demo1.txt


using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args) {
Console.WriteLine("Hello World!");
Console.ReadKey();
}
}
}


demo2.txt


using System;
using System.Windows.Forms;

static class ClassApp{
static void Main() {
Application.Run(new Form());
}
}


3:然后再打开cmd,cd到txt文件所在目录下输入如下命令

csc
/out
: demo1.exe demo1.txt


csc
/out
: demo2.exe demo2.txt


Linux上的编译(ubuntu12.04为例子,我就会这个)

1.使用终端,ctrl+alt+T,或者文件系统中搜索terminal
2.查看磁盘信息df -h
3.http://download.mono-project.com/sources/mono/ 选择mono版本
例子
cd /downloads
wget http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2 //下载
tar -jxvf mono-3.0.6.tar.bz2 //解压
cd mono-3.0.6 //进入目录
./configure --prefix=/usr 配置目录
make //编译
make install //安装

1.打开终端,进入相应目录

2.

mcs test.cs


之后目录上就会有一个test.exe

运行 mono test.exe 就可以运行

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: