Saeid Saeid - 1 year ago 70 Question

Which project templates I can use to create a winform dll library?

Which project templates in visual studio are appropriate for creating a Winform dll libaray.
I want to use it for creating a plug-in interface window. I am looking for an alternative for

WPF User Control Library
in Wiforms.

Answer Source

Create a project using the project template Class Library

enter image description here

If you are looking to use WinForm classes in your library you are going to have to add the reference to System.Windows.Forms as this is not included by default in a Class Library project (they are generally used for utility functionality that doesn't require GUI elements) Not to say including GUI elements in a library is wrong, just uncommon, so they don't bother including it by default to cut down on dependencies.

To add System.Windows.Forms:

Solution Explorer -> Right Click References -> Add Reference -> Assemblies -> Framework

Then scroll until you find System.Windows.Forms, check it and click OK. You can now use WinForm objects in your library.

If you find yourself needing to test library GUI elements Windows Forms Control Library template project would probably be a better option

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download