C# Hello World in Mono on Windows
The following are the basic steps for quickly getting Mono up and running on Windows.
- Download the Mono Installer for Windows. This installs Mono, Gtk#, and XSP (a webserver for serving ASP.NET applications).
- Save the following code into a file called HelloWorld.cs
using System; public class HelloWorld { public static void Main(string[] args) { Console.WriteLine("Hello World"); } } - Click Start–>Mono 1.x.x for Windows–>Mono-1.x.x Command Prompt. This should bring up a terminal window with the Mono directory added to your path. This way gmcs, mono, etc. will work from whatever directory you are currently in.
- Type
gmcs HelloWorld.csinto the Command Prompt to compile your source code. - Type
mono HelloWorld.exeinto the Command Prompt to run the program.
Nothing complicated, but I was looking around for something to make sure that the basics were configured correctly.
