2012-06-15 41 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