Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Using and Compiling Windows.Form

I am working on coding a GUI with C#. 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

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. I don't know why it's telling me to reference it when I already have.

like image 725
Veech Avatar asked Dec 05 '25 13:12

Veech


1 Answers

You need to add /r:System.DLL to your command line arguments

like image 185
bluevector Avatar answered Dec 08 '25 06:12

bluevector



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!