mac上c#环境搭建

为了学习unity游戏开发,选择了使用C#。遵循通过命令行而非集成环境来运行程序的习惯,博主在Mac上安装了Mono环境以支持跨平台运行C#程序。详细步骤包括从官方网站下载并安装Mono,编写并编译运行简单的C# HelloWorld程序,通过csc编译器和mono运行时完成执行。通过命令行选项了解csc和mono的使用帮助。
摘要由CSDN通过智能技术生成

想要开始学习unity游戏开发,看了下,可以用c#也可以用js,但是c#毕竟是主流,于是需要先搭建c#环境。

对于学习一门新的语言,我的做法是通过命令行运行程序,而不是集成环境下的一键搞定。

于是查了下需要安装mono,这套环境可以让我们在其他操作系统平台上运行c#程序,于是我找到官方http://www.mono-project.com/下载了mac平台的安装包。

接着我尝试着写了一个c#的helloworld.cs程序,然后编译运行之。

using System;
using System.Collections.Generic;
using System.Text;


namespace ConsoleApplication1
{
class Program
    {
static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
Console.ReadLine();
        }
}
}

具体操作如下:

csc helloworld.cs

编译成功,生成了一个helloworld.exe。我又找了下需要用mono运行之。

mono helloworld.exe

成功输出Hello,world!

csc顾名思义就是CSharpCompiler的意思,我想深入了解下,于是csc --help,csc -h,我靠都不行,查了下需要csc /help,,,,,

Microsoft (R) Visual C# Compiler version 2.3.1.61919 (57c81319)
Copyright (C) Microsoft Corporation. All rights reserved.
                              Visual C# Compiler Options

                        - OUTPUT FILES -
 /out:<file>                   Specify output file name (default: base name of file with main class or first file)
 /target:exe                   Build a console executable (default) (Short form: /t:exe)
 /target:winexe                Build a Windows executable (Short form: /t:winexe)
 /target:library               Build a library (Short form: /t:library)
 /target:module                Build a module that can be added to another assembly (Short form: /t:module)
 /target:appcontainerexe       Build an Appcontainer executable (Short form: /t:appcontainerexe)
 /target:winmdobj              Build a Windows Runtime intermediate file that is consumed by WinMDExp (Short form: /t:winmdobj)
 /doc:<file>                   XML Documentation file to generate
 /refout:<file>         
  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值