Search code examples
winformscontrolsc++-cliclr

Creating a CLR User Control


Under Visual Studio 2019, I would like to create a user control in C++/CLI. I didn't succed to compil a dll.

What I did :

  1. Create a new empty CLR Project (because I don't have the option to create directly a user control project)
  2. Menu Project -> Properties -> Link editor -> System -> syb system -> Windows
  3. Panel Solution explorer -> Right clic on Header files -> Add -> new element -> CLR -> user control CLR
  4. I compil the project and restart Visual Studio (in order to access my component designer overwise the designer gives me an error)
  5. I add some graphical elements on my control (buttons, labels, etc) and I compil
  6. I try to find the dll in the release folder but I only find a *.dll.metagen and no dll

I tried to change : Menu Project -> Properties -> General -> configuration type -> dynamic library (.dll) but it does nothing better

Thanks for your help


Solution

  • Found the solution : At start, when creating a new project, choose : "CLR Class Library" as type of project next You can do : Right click on "header files" -> add -> new element" -> "-> CLR -> user control CLR". It compile and create a dll that contain a user control that can be imported in a windows form