C# 使用和编译 Windows.Form

本文关键字:Windows Form 编译 | 更新日期: 2023-09-27 18:37:26

我正在用C#编写GUI。我正在按照这个简单的教程开始。要编译,我需要引用System.Windows.Forms.DLL System.Drawing.DLL,所以我输入

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"。我不知道为什么它告诉我在我已经拥有它时引用它。

C# 使用和编译 Windows.Form

您需要

在命令行参数中添加/r:System.DLL