“The time has come…to talk of many [technologies].” –Lewis Carroll(‘The Walrus and the Carpenter’)
Writing Your First Program With Mono And MonoDevelop
Installing Mono And MonoDevelop on Gentoo and Debian/Ubuntu(5.10)
Installing Mono And MonoDevelop K/Ubuntu(6.06)
Mono applications can be developed using any text editor and the mono compiler(mcs). Type the following program in your favourite editor:
[csharp]
using System;
namespace FirstMono
{
class Hello
{
public static void Main(string[] args)
{
Console.WriteLine(“Hello World!”);
}
}
}
[/csharp]

Now go to a shell prompt and compile and run the program:
sh# mono Hello.exe
You can copy the same Hello.exe file to a Windows machine and execute it there; you get the same output.
To create a C# application using the MonoDevelop development environment, follow these simple steps:
- Start Monodevelop from the GNOME/KDE menu.
- Select ‘File->New Project’ or press Ctrl-Shift-N to create a new Project/Solution. Select “C#” in the left pane and “Console Project” in the right pane of the dialog box.
- Type ‘FirstMono’ as the project name(in Location->Name field) and press the “New” button. You will see a sample C# file created in the open window(sample code is not created if “Blank Project” is selected in the “New Solution” Dialog box). Modify the string passed to the WriteLine() method if you wish.
- Select “Run->Build Solution” to build the project. Run the project using “Run->Run”(or press “F8″). The output is displayed in the Application Output window at the bottom.

Most of the frequently used operations(like “Build Solution”, “Run” etc) can be invoked from the toolbar buttons too.
| Print article | This entry was posted by tabrez on June 28, 2006 at 10:18 pm, and is filed under GNU/Linux, Mono. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 4 years ago
Hi,
I’ve gotten everything to work wonderfully with Suse Linux Enterprise Desktop 10 except one thing. Every example I see shows that you can run a .net application directly from the command line. I always have to use mono to execute the binary. If I were to run ./HelloWorld.exe from the command prompt I get “cannot execute binary file” but by running it this way “mono HelloWorld.exe” everything works well. What am I missing? I have also checked to make sure the binary file is marked executable and group, user, and other has permission to execute.
about 4 years ago
The rules are like this:
Instead of explaining all this in every example on Mono, people generally tend to just say ‘execute the Mono app using `./HelloWorld.exe`’ and let the user use whatever is appropriate in their case. I have adjusted the post to now use ‘mono’ to run the application.
about 4 years ago
Thank you, that undoes all of the confusion!
about 3 years ago
Quick and easy tutorial. Thanks!
about 3 years ago
Hi All,
MonoDevelop is good for Cross-platform .
iam using Monodevelop for my project.but i still i have one dought in Mono Reports.
MonoDevelop Supports ActiveReports and CrystalReport on linux and window?
Regards
m m Kalyan
about 3 years ago
You can access the Crystal Reports from C#/Mono on Windows platform. Because CrystalReports.NET makes use of Win32 and COM API, it is not available on gnu/linux platform. You can access Crystal Reports.NET from Mono using the Web Service interface on either platform. ActiveReports is also not available on gnu/linux platform.
about 3 years ago
[Comment ID #1592 Will Be Quoted Here]
We are using monodevelop for our BE project.We are having many doubts about using mono.Would u please help us?
Pranjal Bathia
about 2 years ago
In Ubuntu 7.10 Gutsy, executing a Mono application can result in: bash: ./Foo.exe: cannot execute binary file
Or if using sh: ./Foo.exe: 1: MZ
But if you install the binfmt-support package, it will work.
openSUSE and SLED probably have a similar package.
about 2 years ago
Man i was really confused but this short and simple tutorial was excellent.. ..Keep up the great job buddy :-)