After you get Mono installed, it’s probably a good idea to run a quick Hello World program to make sure everything is set up properly. That way you’ll know that your Mono is working before you try writing or running a more complex application.

Console Hello World

To test the most basic functionality available, copy the following code into a file called hello.cs.

To compile, use csc:

The compiler will create “hello.exe”, which you can run using:

The program should run and output:

HTTPS connections

To make sure HTTPS connections work, download and run the tlstest tool (needs Mono >= 3.4.0).

The program prints an error if something is wrong.

WinForms Hello World

The following program tests writing a

To compile, use csc with the -r option to tell the compiler to pull in the WinForms libraries:

The compiler will create “hello.exe”, which you can run using:

NOTE: on macOS you’ll have to wait around a minute the very first time you run this command. You also need to use mono32 since WinForms isn’t supported on 64bit yet.

Create a text file with the name hello.aspx and the content:

Then run the xsp4 command from that directory:

Use a web browser to contact http://localhost:9000/hello.aspx

The following program tests writing a Gtk# application.

To compile, use mcs with the -pkg option to tell the compiler to pull in the Gtk# libraries (note that Gtk# must be installed on your system for this to work):

The compiler will create “hello.exe”, which you can run using:

If the hello world program compiles without problems than you’ve installed the software correctly.