Writing First “HelloWorld” Desktop Project on MonoDevelop

What is MonoDevelop

MonoDevelop is an open source integrated development environment for the Linux platform, Mac OS, and Microsoft Windows, primarily targeted for the development of software that uses both the Mono and Microsoft .NET frameworks. MonoDevelop integrates features similar to those of NetBeans and Microsoft Visual Studio, such as automatic code completion, source control, a graphical user interface (GUI) and Web designer. MonoDevelop integrates a Gtk# GUI designer called Stetic. It currently has language support for C#, Java, Boo, Visual Basic.NET, Oxygene, CIL, Python, Vala, C and C++.

MonoDevelop enables developers to quickly write Desktop and ASP.NET Web applications on Linux, Windows and Mac OSX. MonoDevelop makes it easy for developers to port .NET applications created with Visual Studio to Linux and to maintain a single code base for all platforms.

Installing MonoDevelop on Windows

  1. Go to the page for the MonoDevelop free downloadhttp://monodevelop.com/Download

    mono1.gif
  2. Select your operating system. In this case we selected "Windows"
  3. For MonoDevelop 3.0.4.7, you must first install its prerequisites, they are:
    • .Net Framework 4.0
    • GTK# for .Net 2.12.10
  4. You can install both of the prerequisite packages into your system from the same Download page just underneath "MonoDevelop Installer" (see the above Image-1)
  5. After proper installing both packages, click the "Download" for the MonoDevelop Installer. The following window appears:


    mono2.gif
  6. Click "Run". The following security warning message window will appear:



  7. Click "Run" in the preceding window.

    mono4.gif

  8. Click "Next". The License Agreement window will appear:

    mono5.gif

  9. Click "Next". The Destination folder windows will appear:

    mono6.gif

  10. Click "Next". It will ask for the destination folder. Go with the default one.

    mono7.gif

  11. Click "Install".

    mono8.gif

  12. Click "Finish". Now you are ready to go with the MonoDevelop IDE.

Creating First Desktop Project in MonoDevelop

  1. Open MonoDevelop from Start -> All Programs. You see your brand new MonoDevelop IDE (looks quite different from Microsoft Visual Studio!)

    mono9.gif
  2. To create a new Desktop project, go to File -> New -> Solution.
  3. A new Project window appears. 

    mono10.gif
  4. Select C# Node in the left panel and then select Gtk# 2.0 project to create our first "HelloWorlkd" Project. Give the name of your project and click "Forward". You will see following window:

    mono11.gif

  5. Click "OK". A new Desktop project is created for you. A "By Default" form with name "MainWindow" is already included in the project.

    mono12.gif

  6. Select the MainWindow.cs You will see two TAB options: Source and Designer. In the Source, we can write our C# code and in the designer we can add controls as usual in order to make any Desktop project.

    mono13.gif

  7. Select the Designer Tab and click the Tool Box tab on the right side of your IDE as:

    mono14.gif

  8. Now you want to add a control. Right? Let us add a button but before adding a button on your form, you need to set a container for this. Select "Fixed" from the "Container" section of the Toolbox and drag & drop this container onto the Form. It will be added to you form. Now add a Button in the same way. Give a name to the button.

    mono15.gif

  9. Select the button and go to the "Signal" tab on the property window. It will allow you to add various events to the button. Expand the "Button Signals" node and add a new event "OnClick" for the click action. Hit enter. A new event "OnClick" will be added onto your source.

    protected void OnClick (object sender, EventArgs e)
    {
       throw new System.NotImplementedException ();
    }

    mono16.gif

  10. Add another label just to write some message onto the GUI and update the OnClick() event handlers:

    protected void OnClick (object sender, EventArgs e)
    {
       lbl_WelcomeMsg.Text = "Hello ! Welcome to the world of MonoDevelop";
    }
     
  11. Build and run the project. You will see the following window on running:

    mono17.gif

So, here you have your first simplest "HelloWorld" Desktop project running!

Thanks,

Hemant Srivastava


Similar Articles