By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

Beginner: C# Winform in Linux using Mono

P: n/a
I have a very beginner and fundamental question regarding porting and
running C# programs in Linux. As a background I am a total idiot when
it comes to Linux but somehow managed to install Ubuntu 7.04 Feisty
Fawn and Monodevelop 0.12 on a machine. So far so good, however I
cannot compile and run a simplest winform application. Basically,
"System.Windows.Forms" is not recognized and cannot even do a
MessageBox.Show.

So, my basic question is what I have to do to be able to compile and
run the following simple Winform application on Ubuntu 7.04 with
momodevelp 0.12? Apparently "System.Windows.Forms" is missing and
cannot get and install it. Any help or pointer is highly appreciated.

------------ sample program from mono site ------------------
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!");
}
}

Jun 19 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ysgrifennodd Hitchkas:
>
So, my basic question is what I have to do to be able to compile and
run the following simple Winform application on Ubuntu 7.04 with
momodevelp 0.12? Apparently "System.Windows.Forms" is missing and
cannot get and install it. Any help or pointer is highly appreciated.

------------ sample program from mono site ------------------
using System;
using System.Drawing;
using System.Windows.Forms;
Do you get any errors when you compile? If so, what error message do
you get? Have you included System.Windows.Forms in your project references?

You might also think about posting to the Mono list:

Mo*******@lists.ximian.com

HTH
Peter
Jun 19 '07 #2

P: n/a
Hitchkas wrote:
I have a very beginner and fundamental question regarding porting and
running C# programs in Linux. As a background I am a total idiot when
it comes to Linux but somehow managed to install Ubuntu 7.04 Feisty
Fawn and Monodevelop 0.12 on a machine. So far so good, however I
cannot compile and run a simplest winform application. Basically,
"System.Windows.Forms" is not recognized and cannot even do a
MessageBox.Show.

So, my basic question is what I have to do to be able to compile and
run the following simple Winform application on Ubuntu 7.04 with
momodevelp 0.12? Apparently "System.Windows.Forms" is missing and
cannot get and install it. Any help or pointer is highly appreciated.

------------ sample program from mono site ------------------
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!");
}
}
Hi,

I'm not sure what the Ubuntu package names are (I'm running Debian), but you
may need to install the appropriate '-cil' versions of the libraries. In
Debian, the package name for winforms is 'libmono-winforms1.0-cil'
and 'libmono-winforms2.0=cil'.

After ensuring you have these packages installed, you need to make sure
you're compiling with a reference to those libraries, so, using the
command-line:

gmcs -r:System.Windows.Forms.dll <source-files>

And, in MonoDevelop, you need to add references to the appropriate
libraries.

--
Tom Spink
University of Edinburgh
Jun 19 '07 #3

P: n/a
On Jun 19, 3:12 pm, Peter Bradley <p.brad...@dsl.pipex.comwrote:
Ysgrifennodd Hitchkas:
So, my basic question is what I have to do to be able to compile and
run the following simple Winform application on Ubuntu 7.04 with
momodevelp 0.12? Apparently "System.Windows.Forms" is missing and
cannot get and install it. Any help or pointer is highly appreciated.
------------ sample program from mono site ------------------
using System;
using System.Drawing;
using System.Windows.Forms;

Do you get any errors when you compile? If so, what error message do
you get? Have you included System.Windows.Forms in your project references?

You might also think about posting to the Mono list:

Mono-l...@lists.ximian.com

HTH

Peter
The error is that dotnet library/package is not available. Thanks for
your help and for the pointer to the Mono list. I will post there.

Jun 20 '07 #4

P: n/a
On Jun 19, 3:27 pm, Tom Spink <tsp...@gmail.comwrote:
Hitchkas wrote:
I have a very beginner and fundamental question regarding porting and
running C# programs in Linux. As a background I am a total idiot when
it comes to Linux but somehow managed to install Ubuntu 7.04 Feisty
Fawn and Monodevelop 0.12 on a machine. So far so good, however I
cannot compile and run a simplest winform application. Basically,
"System.Windows.Forms" is not recognized and cannot even do a
MessageBox.Show.
So, my basic question is what I have to do to be able to compile and
run the following simple Winform application on Ubuntu 7.04 with
momodevelp 0.12? Apparently "System.Windows.Forms" is missing and
cannot get and install it. Any help or pointer is highly appreciated.
------------ sample program from mono site ------------------
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!");
}
}

Hi,

I'm not sure what the Ubuntu package names are (I'm running Debian), but you
may need to install the appropriate '-cil' versions of the libraries. In
Debian, the package name for winforms is 'libmono-winforms1.0-cil'
and 'libmono-winforms2.0=cil'.

After ensuring you have these packages installed, you need to make sure
you're compiling with a reference to those libraries, so, using the
command-line:

gmcs -r:System.Windows.Forms.dll <source-files>

And, in MonoDevelop, you need to add references to the appropriate
libraries.

--
Tom Spink
University of Edinburgh- Hide quoted text -

- Show quoted text -
Thank you very much. That was it. I also upgraded to monodevelop
0.14 and it works now.

Jun 20 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.