Adding Intellisense for RadControls and Sitefinity Controls in .ASCX Files Placed Inside a Class Library Project

June 18, 2013 Digital Experience
If you are using a separate class library project to build your Sitefinity modules you are probably wondering how to enable intellisense for all of the RadControls and Sitefinity controls in your .ascx files that are placed inside that class library as embedded resources. Here I will provide some simple steps to enable that intellisense in Visual Studio.

1. First you have to put Telerik.Sitefinity.dll and Telerik.Web.UI.dll in the GAC. One way to do it is to use the
gacutil.exe. Open your Visual Studio Command Prompt and execute the following commands:

gacutil /i “[path to your dll folder]/Telerik.Sitefinity.dll”
gacutil /i “[path to your dll folder]/Telerik.Web.UI.dll”

2. Then you need to get the assemblies full names. Gacutil.exe can do this for you. Just execute these commands and copy the output.

gacutil.exe /l Telerik.Sitefinity
gacutil.exe /l Telerik.Web.UI

The result from each command should be something like this:



3. You have to place a web.config file in the root directory of your class library project.

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation>
      <assemblies>
        <add assembly="Telerik.Web.UI, Version=2012.3.1308.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
        <add assembly="Telerik.Sitefinity, Version=6.0.4100.0, Culture=neutral, PublicKeyToken=b28c218413bdf563"/>
      </assemblies>
    </compilation>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2012.3.1308.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
        <add tagPrefix="sitefinity" namespace="Telerik.Sitefinity.Web.UI.Fields" assembly="Telerik.Sitefinity, Version=6.0.4100.0, Culture=neutral, PublicKeyToken=b28c218413bdf563"/>
      </controls>
      <namespaces>
        <add namespace="Telerik.Web.UI" />
        <add namespace="Telerik.Sitefinity.Web.UI" />
      </namespaces>
    </pages>
  </system.web>
</configuration>

4. In you .ascx files register the assemblies with their full names like this

<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity, Version=6.0.4100.0, Culture=neutral, PublicKeyToken=b28c218413bdf563" Namespace="Telerik.Sitefinity.Web.UI" %>
  
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI, Version=2012.3.1308.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" %>

5. Rebuild your solution and close Visual Studio. After you open it again your intellisense should work.

 

NOTE: I strongly recommend to remove these assemblies from the GAC when you’re finished with your development and you don’t need them anymore.

ivan georgiev