[Mono-list] Windows.Forms not found

Mladen Bestvina bestvina at math.utah.edu
Mon Jul 2 17:51:08 EDT 2007


The compilation of the code below fails, apparently because 
Windows.Forms cannot be found on the system. I do have 
Windows.Forms.dll. I am using Ubuntu Feisty Fawn and I installed mono 
from ubuntu packages.

Any advice is appreciated.



mb at hvar:~/mono$ mcs -r:System.Drawing sample.cs
sample.cs(3,7): error CS0234: The type or namespace name `Windows' does 
not exist in the namespace `System'. Are you missing an assembly reference?
sample.cs(3,1): error CS0246: The type or namespace name `Windows.Forms' 
could not be found. Are you missing a using directive or an assembly 
Compilation failed: 2 error(s), 0 warnings


using System;
using System.Drawing;
using System.Windows.Forms;

public class HelloWorld : Form
static public void Main ()
Application.Run (new HelloWorld ());

public HelloWorld ()
Button b = new Button ();
b.Text = "Click Me!";
b.Click += new EventHandler (Button_Click);
Controls.Add (b);

private void Button_Click (object sender, EventArgs e)
MessageBox.Show ("Button Clicked!");

More information about the Mono-list mailing list