locked
VS 2008 Web Deployment Project User Control Library RRS feed

  • Question

  • User-183668729 posted

    I am new to the Web Deployment Project tool.  What I am attempting to do is create a single dll containing user controls with the ascx code compiled into the dll.  I have a Web Application Project (not Web Site Project) in VS 2008.  It contains one simple test control name TestCustomControl in the namespace TestCustomLibrary.Controls.  I created a Web Deployment Project for this WAP, and successfully generated TestCustomControlLibrary.dll using the "Merget All Outputs into a Single Assemply" option.  Selected the Treat as a library component option and unselected the Allow this site to be Updatable option.

    It generates the file fine.  I then created a second Web Application Project in a different solution.  Added the TestCustomLibraryControl.dll as a reference to the project.  I then added the following @Register directive to an aspx page:

    <%@ Register Assembly="TestCustomControlLibrary" Namespace="TestCustomLibrary.Controls" TagPrefix="MyCustomControl" %>

    However, when I attempt to use the MyCustomControl tag prefix in the page, it is not available through intellisense.  If I ignore this and put in the tag (i.e. MyCustomControl:TestCustomControl) the application compilies, but when I run the page it throws and error that the tag is not recognized.

    Any help on what I may be doing wrong would be greatly appreciated.

    Friday, August 21, 2009 12:47 PM

Answers

  • User372121194 posted

     Hi,

    You need to compile Custom User Control's HTML and source code into assembly. Please disable "Allow this precompiled site to be updatable" option in Web Deployment project.

    For more information, see http://msdn.microsoft.com/en-us/magazine/cc163448.aspx (Especially in section: Creating Reusable User Controls).

     

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 26, 2009 5:39 AM