Search code examples
c#visual-studio-2008sharepointweb-partswebusercontrol

Compile Web User Control to DLL


I created a Web User Control in Visual Studio 2008. I want to compile that Web User Control to a DLL so i can eventually use it in a SharePoint Web Part.

But i have no idea how i can compile or use my Web User Control in SharePoint.

Anyone any idea how this works?


Solution

  • Read this...

    In your manifest.xml include this..

    <TemplateFile Location="ControlTemplates\"Your Web User Control Name".ascx" />
    

    Then in your ascx file include this...

    RootFiles\TEMPLATE\ControlTemplates\"Your Web User Control Name".ascx
    

    Then call from your .cs file as

    _value = Page.LoadControl("~/_controltemplates/"Your Web User Control Name".ascx");
    

    EDIT

    Try this...

    Go to Start> All Programs > Visual Studio 2008 > Visual Studio Tools > Click Visual Studio 2008 Command Prompt. Type the below command and press enter.

    devenv.exe /resetskippkgs