使用System.Windows.Forms破坏Mono C#代码

时间:2021-10-27 20:37:08

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

几个月前,我开始使用Mono编译的一个相对简单的C#应用​​程序。

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

我今天尝试恢复这方面的工作,尽管有一个可执行文件证明它编译好之前,它现在抱怨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

C:\ Program Files \ Mono-2.0.1 \ bin> mcs ../projects/test_1/test.cs ../projects/test_1/test.cs(2,14):错误CS0234:类型或命名空间名称'命名空间`System'中不存在Windows'。你错过了装配参考吗?编译失败:1个错误,0个警告

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

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).

但是,-v2参数不起作用,没有它,只有一系列其他命名空间错误(ToolStripButton和类似)。

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

我已经下载了最新的Mono 2.2但这仍然会产生同样的错误。

How do I fix this?

我该如何解决?

1 个解决方案

#1


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

gmcs uses the .NET 2.0 profile.

gmcs使用.NET 2.0配置文件。

#1


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

gmcs uses the .NET 2.0 profile.

gmcs使用.NET 2.0配置文件。