1

我正在运行冻结的 Debian 7.0 Testing/Wheezy。

这是我的 C# 示例代码:

using System.Windows.Forms;
using System.Drawing;

public class Simple : Form
{
    public Simple()
    {
       Text = "Simple";
       Size = new Size(250, 200);
       CenterToScreen();
    }

    static public void Main()
    {
       Application.Run(new Simple());
    }
}

在使用以下命令编译时,我使用 System.Drawing 和 System.Windows.Forms 引用以及在命令行中获得了在 Monodevelop 中工作的上述 C# WinForms 代码示例:

mcs /tmp/Simple.cs -r:/usr/lib/mono/4.0/System.Windows.Forms.dll \
       -r:/usr/lib/mono/4.0/System.Drawing.dll

我试图在mcs不需要使用-r开关/参数的情况下使命令工作(顺便说一句,我无法通过查看 man mcs 找到有关信息 - 我基本上在某个随机网站上找到了这个开关/参数并且它有效) .

为了检查它是否暂时有效,我发出了

export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll

在发出之前mcs /tmp/Simple.cs,失败并出现以下输出中的错误:

deniz@debian:~$ cd /tmp
deniz@debian:/tmp$ export PATH=$PATH:/usr/lib/mono/4.0/System.Windows.Forms.dll:/usr/lib/mono/4.0/System.Drawing.dll
deniz@debian:/tmp$ mcs Simple.cs 
Simple.cs(1,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Simple.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
deniz@debian:/tmp$

上面的输出告诉我 mcs 编译器/实用程序没有看到 dll 文件,但我不知道还能尝试什么。

对于让 WinForms 和绘图库自动“查看”的任何帮助,我们将不胜感激!

4

1 回答 1

0

我正在尝试使 mcs 命令工作而不需要使用 -r 开关/参数

这是不可能的,除非您告诉 mcs 查找它们(使用 -r:... 完成),否则 mcs 不会查找库。

于 2012-09-09T18:40:28.143 回答