Compile web application project ascx into dll

前端 未结 6 1470
孤独总比滥情好
孤独总比滥情好 2021-01-02 04:36

Is it possible to compile a web application project .ascx (user control) into a dll?

I want to do the following:

  1. Use the same control in multiple websi
6条回答
  •  别那么骄傲
    2021-01-02 05:11

    Another way would be to convert user control to the custom control. There is an nice article on MSDN: Turning an .ascx User Control into a Redistributable Custom Control which describes exactly how to do that. Here is the summary:

    1. Write your user control as you normally would, typically using the Visual Studio designer.
    2. Test it using a simple page before trying to deploy it.
    3. Deploy the application to precompile it.
    4. Grab the user control's assembly produced by the deployment step, and you're essentially done: You have your custom control.
    5. Finally, use your custom control in other apps the same way as you always use custom controls.

    Hope this helps.

提交回复
热议问题