Page 1 of 1

Mono: A New Platform PT.2 - Installing/Using Mono

#1 Amrykid  Icon User is offline

  • 4+1=Moo
  • member icon

Reputation: 147
  • View blog
  • Posts: 1,589
  • Joined: 16-December 08

Posted 18 May 2009 - 03:53 AM

Mono: A branch to other platforms

Continuing from where we left off

In my last tutorial, we got a basic understanding of Mono and even checked if a existing .net application would run on Mono. Now its time to get Mono running on our development machine.
Installation

To start off, go to http://www.mono-project.com and click download Mono. Select Windows and click Mono and GTK#. Once that downloaded, run the installation.
Attached Image
Click next until you get to this screen.
Attached Image
Those are all of the files required for the best experience developing in Mono. I'm gonna explain everything in this screen shot. GTK+ is a library used by GNOME, one of the main desktop environments in Linux. GTK# is a C# wrapper to use GTK+ in your applications. I do not know what Monodoc is unfortunately. Gecko# is another c# wrapper, which allows you to access Gecko, Mozilla Firefox's layout engine. I also do not know what XSP is but I'm sure we will find out as we go. Click next until the installation starts.
Attached Image
This installation may take a while so as we wait, lets talk about a IDE that can develop applications under Mono. There are two IDE I know of that compile under that platform. They are SharpDevelop and MonoDevelop. SharpDevelop is a c# IDE that started when .net started and MonoDevelop is a software fork thats developed under mono in c#. But now, they don't seem to be related to each other because they have when there separate ways. MonoDevelop isn't currently running on Windows yet, but SharpDevelop is so head over to http://www.sharpdevelop.net and download SharpDevelop.
Once we have Mono and SharpDevelop installed. We can install the Mono AddIn for SharpDevelop. The AddIn is attached to this article, so just download it to your desktop.
Go to your SharpDevelop's installation directory and navigate to the AddIns folder. Create a folder called samples and in that, create a folder called Mono.AddIn. Remember that zip we just download? Extract that into the Mono.AddIn folder and it should look like this:
Attached Image
Creating a Hello World Application

The moment we've been waiting for! Your first Mono application. Lets get started by opening SharpDevelop and click new solution. Click C# and in that, click Mono and in that click GTK# application.
Attached Image
Lets name it MonoHelloWorld. After you create the project, it should show up like this:
Attached Image
Before we dive into coding, we need to tell SharpDevelop to run our app under Mono. So go to Projects > Project Options > Debug. Your settings should look like this:
Attached Image
The start external program option should be *monoinstallation directory here*\bin\mono.exe. And the other options should be what you see in the picture. Now switch back to you Mainwindow.cs and click Debug (the green arrow). Thats is a GTK# application. The downside to this is, you have a lot of new classes to learn. But if you loads of free time, then this will be easy.
After a quick modification to the code, it should be like this.
Attached Image
Now, finally, click Debug (green arrow) and it will run our new Mono Application. And it should look like this:
Attached Image
Notes

If you don't prefer hand-coding a UI (using a designer) , then you should get Linux or Mac and get MonoDevelop. Otherwise, you can wait till it gets ported to Windows, or do it the hard way. What ever way you choose.
Conclusion

To conclude this tutorial, I'm gonna summarize what we have learned. We have installed Mono on our Development Machine. We have Installed and Configured SharpDevelop to compile on Mono. We have coded a simple Mono applications running on GTK#. Well, that pretty much sums it up. We have did a lot in this tutorial and even lost about 700mbs of Hard Disk space. In the next tutorial, we will get into advanced coding in GTK# and even take a look at Glade# another UI library in Mono.
Download

This artcle can be downloaded as PDF from here.
And the Mono.AddIn.zip can be downloaded here.

Attached image(s)

  • Attached Image

This post has been edited by Amrykid: 18 May 2009 - 06:09 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1