C♯ and mono are both a blessing and a curse. Most documentation, FreeBSD-specific or not, on the internet are more or less outdated. Maybe I was looking in the wrong places. It was really frustrating. Soon this will be outdated too.

Start by adding lang/mono. Then add x11-toolkits/libgdiplus.

If you want to use the Gtk libraries, add x11-toolkits/gtk-sharp20 and/or x11-toolkits/gtk-sharp30.

Remember, mcs is the unified C♯ compiler. No need to run gmcs nor dmcs.

Now you should be able to compile this example named hw.cs:

using System.Windows.Forms;

class Program {
  static void Main()
    MessageBox.Show("Hello, world!");

Use this command when compiling:

mcs -pkg:dotnet hw.cs

Run the resulting executable:

mono hw.exe

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>