views:

1073

answers:

1

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?

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

gmcs uses the .NET 2.0 profile.

d0k
curious, what's the g stand for?
JaredPar
if I remember correctly it stands for generics
d0k
Thanks, this worked. Not sure why I didn't note that this was necessary last time.
Peter Boughton
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
"-pkg:dotnet" also works
Vanuan