简体   繁体   English

C#使用和编译Windows.Form

[英]C# Using and Compiling Windows.Form

I am working on coding a GUI with C#. 我正在使用C#编写GUI代码。 I'm following this simple tutorial to get started. 我正在按照这个简单的教程开始。 To compile, I need to reference System.Windows.Forms.DLL System.Drawing.DLL, so I type 要编译,我需要引用System.Windows.Forms.DLL System.Drawing.DLL,所以我输入

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

However, I get errors like this: 但是,我得到这样的错误:

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)

I've already added "c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319" to my path. 我已经在我的路径中添加了“c:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319”。 I don't know why it's telling me to reference it when I already have. 我不知道为什么它告诉我在我已有的时候引用它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM