C# Using and Compiling Windows.Form

c#, reference, system.componentmodel, user-interface

Solution

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

Problem

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.

Original source