You are here:   ArielOrtiz.com > Compiler Design > Installing Mono C# on Ubuntu

Installing Mono C# on Ubuntu

Installation

These instructions allow you to install Mono C# 4.2 and MonoDevelop 5.10 on Ubuntu 16.04.

Building a C# program

  1. Open MonoDevelop. Type monodevelop and press Enter at the Unity launcher or terminal.
  2. From the IDE’s menu, select File/New/Solution.... In the New Solution dialog window, select C# and choose the Empty Project icon. Type your project’s name (for example: hello_world) in the corresponding text field. You may also specify the project’s location. If you don’t, the project’s directory will be placed under your home folder. Press the OK button.

  3. Type Ctrl+N to create and add a new C# source file to your project. In the New File dialog window, check first the Add to project box. Afterwards, select General and choose the Empty File icon, then type the name for your new file (for example: hello.cs) in the corresponding text field. Finally press the New button.

  4. In the hello.cs editor window, copy the following program and save it using Ctrl+S.

    // The "Hello World!" program in C#.
    
    using System;
    
    namespace HelloWorld
    {
        public class Hello
        {
            public static void Main ()
            {
                Console.WriteLine ("Hello World!");
            }
        }
    }
    
  5. Type Ctrl+F5 to run the program. You should see the following text in the IDE’s Application Output pad:

    Hello World!