How can I use System.Windows.Forms in MonoDevelop

2019-06-28 08:25发布

问题:

I met this problem at the beginning of my work. I am using Mono 2.10 with MonoDevelop 2.8. When I create a new C# project, I can not use:

using System.Windows.Forms

because there is no such namespace here.

I searched for some answer and tried:

apt-get install libmono-system-windows-forms4.0-cil and

apt-get install libmono-winforms2.0-cil

but they all tell me I have installed them. So now I'm wondering if I can not write windows forms application with Mono but I can only run such application with it?

回答1:

Although this was answered in the comments, newbies (like me) might appreciate a more spelled-out version:

  • In monodevelop, click the gear/settings icon next to the References folder (or right-click the References folder)
  • Select 'Edit References'
  • Search for windows
  • Check System.Windows.Forms
  • Click OK