How to put a UserControl into Visual Studio toolBox

前端 未结 10 2181
逝去的感伤
逝去的感伤 2020-11-29 01:02

I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can\'t. the UserControl is

10条回答
  •  春和景丽
    2020-11-29 01:37

    There are a couple of ways.

    1. In your original Project, choose File|Export template
      Then select ItemTemplate and follow the wizard.

    2. Move your UserControl to a separate ClassLibrary (and fix namespaces etc).
      Add a ref to the classlibrary from Projects that need it. Don't bother with the GAC or anything, just the DLL file.

    I would not advice putting a UserControl in the normal ToolBox, but it can be done. See the answer from @Arseny

提交回复
热议问题