compiling C# source code in ubuntu

if you want to compile C# source code in ubuntu, then you should install mono.

sudo apt-get install mono

then you have to install this package also

jacobian@jacobian-laptop:~$ sudo apt-get install mono-gmcs

then open mono in your applications tab and open a file that has a C# source code in it. For this time I made a helloworld program based on C#.

this is the code

using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;

namespace HalloWorld
public class Hallo_World
public static string BacaInput(string msg)
Console.BackgroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.Blue;
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Red;
return System.Console.ReadLine();

public static void TulisKonsole(string msg)
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Yellow;

static void Main(string[] args)
Console.BackgroundColor = ConsoleColor.DarkMagenta;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("iNILAh VisuaL C ShaRp");
string nama = BacaInput("sILAkan Masukkan Nama Anda: ");
TulisKonsole("Selamat DAtang ke Dunia C Sharp, " + nama);

and then I open this file with mono and run it. Then it will give this output.

iNILAh VisuaL C ShaRp

sILAkan Masukkan Nama Anda: Selamat DAtang ke Dunia C Sharp,

C# is a good language for programming, I think you should learn it.



3 comments on “compiling C# source code in ubuntu

  1. […] compiling C# source code in ubuntu August 16, 2008 4:05 pm admin Dari Blogger – Agreegator Dari […]

  2. Darojatun says:

    mantab… hidup ubuntu….

  3. Simon says:

    I’ve been trying to get the ConsoleColor to work with mono. But I get errors saying ConsoleColor and Console.Foreground not known in their namespaces. Any idea?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s