【发布时间】:2012-09-02 11:14:04
【问题描述】:
我正在运行冻结的 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 和绘图库,我们将不胜感激!
【问题讨论】:
-
您将目录放在
$PATH中,而不是文件。尝试改变它。 -
这些库不是安装在 GAC 中的吗?为什么要指定它们的完整路径??
-
您的系统上安装了哪个版本的单声道和编译器? (
mono --version,mcs --version) -
"export PATH=$PATH:/usr/lib/mono/4.0;export MONO_PATH=$MONO_PATH:.:/usr/lib/mono/4.0:/usr/lib/mono/gac; mcs /tmp/Simple.cs" 有同样的错误。 mcs --version Mono C# 编译器版本 2.10.8.1 mono --version Mono JIT 编译器版本 2.10.8.1 (Debian 2.10.8.1-5) 版权所有 (C) 2002-2011 Novell, Inc、Xamarin, Inc 和贡献者。 www.mono-project.com TLS:__thread SIGSEGV:altstack 通知:epoll 架构:amd64 已禁用:无 杂项:softdebug LLVM:支持,未启用。 GC:包括 Boehm(带类型 GC 和 Parallel Mark)
标签: linux debian environment-variables mono c#