Reference to System.Windows.Forms in .net7.0 class library project

136 Views Asked by At

I need to add a reference to System.Windows.Forms in class library project written in .net7.0 that will be distributed in NuGet for my young students. How can this be done? The class that I want to add to the project:

public class DebugApp
{
   Form form;
   TextBox textBox = new TextBox();
   Button button = new Button();
   Label label = new Label();
   Panel panel = new Panel();
   List<string> data = new List<string>();
   .....
}
1

There are 1 best solutions below

0
Eikey On

I Create Windows Forms Project, change it to class library in project properties, delete Form1 and Program.cs and it's working.