How to compile single c# file on mac console using mono?

I want to compile a simple "hello world" on mac console. I have made dmcs symbolic on /usr/local/bin/.

using System; 

class Hello 
{ 
      static void Main(){ 
     Console.WriteLine("Hello,World"); 
    } 
}

But after typing

dmcs Hello.cs

I get Hello.exe

.exe file seems a Windows file.

So, How to compile single c# file on mac console using mono?


JamesSugrue is right in your comment, you need to run the project using the mono framework using the described command line.

mono Hello.exe

The mono compiler creates files with extensions just like csc would on Windows. The difference is that on Mac and Linux the extension really is a suggestion about what is inside, rather than a rule like it is on Windows.

链接地址: http://www.djcxy.com/p/63712.html

上一篇: 无法读取'onConnet'属性

下一篇: 如何使用mono在mac控制台上编译单个c#文件?