Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Broken Mono C# code using System.Windows.Forms

A couple of months back I started a relatively simple C# app which I was compiling with Mono.

I try to resume work on this today, and despite having an executable proving it compiled fine before, it is now complaining about System.Windows.Forms

C:\Program Files\Mono-2.0.1\bin>mcs ../projects/test_1/test.cs
../projects/test_1/test.cs(2,14): error CS0234: The type or namespace name 'Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings

I found a forum post of someone with the same error, and this was recommended:

mcs Program.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll -v2

However, the -v2 argument doesn't work, and without it there are just a series of other namespace errors (ToolStripButton and similar).

I have downloaded the latest Mono 2.2 but this still produces the same error.

How do I fix this?

like image 699
Peter Boughton Avatar asked Feb 15 '09 15:02

Peter Boughton


1 Answers

gmcs Program.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll

gmcs uses the .NET 2.0 profile.

like image 108
d0k Avatar answered Oct 11 '22 13:10

d0k