8

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?

Peter Boughton
  • 110,170
  • 32
  • 120
  • 176

1 Answers1

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

gmcs uses the .NET 2.0 profile.

d0k
  • 2,605
  • 19
  • 16
  • curious, what's the g stand for? – JaredPar Feb 15 '09 at 16:03
  • Thanks, this worked. Not sure why I didn't note that this was necessary last time. – Peter Boughton Feb 15 '09 at 16:04
  • 2
    generics. Originally the compiler was a fork/branch of mcs to add generics. Eventually, everything from C# 2.0 was put into it. It was later merged back with mcs, but so many people are used to calling gmcs, that the name wasn't dropped. – jpobst Feb 15 '09 at 16:07