简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM