2012-06-15 46 views
3

我正在用C#编写GUI。我正在关注this简单的教程来开始。要编译,我需要引用System.Windows.Forms.dll的System.Drawing.dll程序,所以我键入C#使用和编译Windows.Form

csc /r:System.Windows.Forms.DLL /r:System.Drawing.DLL FirstForm.cs 

但是,我得到的错误是这样的:

FirstForm.cs(6,14): error CS0012: The type 'System.ComponentModel.Component' is 
    defined in an assembly that is not referenced. You must add a reference 
    to assembly 'System, Version=4.0.0.0, Culture=neutral, 
    PublicKeyToken=b77a5c561934e089'. 
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll: 
    (Location of symbol related to previous error) 

我已经加入“c:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319”到我的路径。我不知道为什么它告诉我在我已有的时候参考它。

+1

为什么不使用Visual Studio Express的呢? – Oded

+1

是的,下载它的家伙。使用命令行是一场噩梦。 – zgnilec

+1

@Veech - jonnyGold是正确的:“/r:System.dll”应该有帮助。 Oded和zgnilec甚至* MORE *正确 - 你绝对完全需要获得MSVS的副本。例如,从[这里]免费的Visual Studio Express(http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express)。 – paulsm4

回答

8

您需要添加/r:System.DLL到命令行参数

+1

这也是Monodevelop的正确答案。 – kodmanyagha