Thursday, February 25, 2016

How to compile mono and run a C# code on CentOS


How to compile mono from source code and use mono to build a C# code on CentOS.


CentOS 6.5


1. Checkout Mono source code from github

Refer to
git clone git://

2. Switch to a branch

cd mono
git checkout mono-4.3.2-branch

3. Build mono from source

./ --prefix=/usr/local
make get-monolite-latest
make install

4. Create a sample C# code

# cat test.cs
using System;
class ExampleClass
    static void Main()
        Console.WriteLine("Hello, world!");

5. Compile C# code using mono and execute it.

mcs test.cs
mono test.exe

No comments:

Post a Comment

Popular Posts