Can't use System.Windows.Forms

A console application does not automatically add a reference to System.Windows.Forms.dll.

Right-click your project in Solution Explorer and select Add reference... and then find System.Windows.Forms and add it.


You have to add the reference of the namespace : System.Windows.Forms to your project, because for some reason it is not already added, so you can add New Reference from Visual Studio menu.

Right click on "Reference" ▶ "Add New Reference" ▶ "System.Windows.Forms"


To add the reference to "System.Windows.Forms", it seems to be a little different for Visual Studio Community 2017.

1) Go to solution explorer and select references

enter image description here

2) Right-click and select Add references enter image description here

3) In Assemblies, check System.Windows.Forms and press ok

enter image description here

4) That's it.