FreeBSD has mono
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