This is a migrated thread and some comments may be shown as answers.

Cannot use Telerik intellisense in Razor views, when these Views are in Class library

9 Answers 455 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pavol
Top achievements
Rank 1
Pavol asked on 23 May 2011, 05:04 PM
Hello,

I'm working on project in ASP.NET MVC. I want to create module architecture. It means, that I want to create modules, in which I'm using Portable Areas and then with MEF I dynamically load this modules. And I have big problem with this one.

Because each module is Class library project, I cannot add @using statement for Telerik controls in Razor views. So I added reference to Telerik.Web.Mvc in Class library. From normal C# class (from Controllers and so on) I'm able to type using Telerik.Web.Mvc.UI.

But when I try this in Razor view, when I want to type @using Telerik.Web.Mvc.UI, I don't have ability to choose Telerik. The reference is added correctly, because when I create for example Grid in View, when I run app, everything works.

So problem is with the way, how Razor views load information for Intellisense. I added web configs, so Intellisense for Html helpers works, but not for Telerik. Of course, everything works fine, when I use MVC3 web application project, but not with Class library.

Do you know about this problem, or do you know, about some specific steps, which I have to accomplish to turn on intellisense for Telerik ?

Thanks.

9 Answers, 1 is accepted

Sort by
0
Mario
Top achievements
Rank 1
answered on 26 May 2011, 01:44 PM
Hello Pavol,
i am almost in the same situation.
Did you find any solution to your problem?

Thanks
Mario
0
Vir
Top achievements
Rank 1
answered on 08 Jul 2011, 05:15 PM
Need help with the same. Can anyone from telerik provide solution for intellisense for telerik controls on MVC 3?  Thanks,
0
Gregory
Top achievements
Rank 1
answered on 06 Sep 2011, 05:23 PM
I am having the exact same issue.  Works fine, until you get into Areas.  Even adding the namespace to the Web.Config in the areas does not help.  Html.Telerik() simply isn't recognized.
0
Georgi Tunev
Telerik team
answered on 07 Sep 2011, 09:59 AM
Hello guys,

Generally speaking, MVC Contrib is an external project and at this point I cannot tell what the reason for the problem is. If you send us a sample project where the problem,  that you refer to, can be reproduced, we will check it and do our best to help you.



Kind regards,
Georgi Tunev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Daniele
Top achievements
Rank 1
answered on 06 Oct 2011, 03:13 PM
Same problem here.. Intellisense simply doesn't recognize Html.Telerik(), even with @using statements and namespaces registered in web.config.
0
savo dev
Top achievements
Rank 1
answered on 07 Oct 2011, 05:46 AM
i think you need a web.config in the root folder of your portable area.  try using these settings and placing it.

<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
            <assemblies>
                <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>
 
        <pages>
            <namespaces>
                <add namespace="System.Web.Helpers" />
                <add namespace="System.Web.Mvc" />
                <add namespace="System.Web.Mvc.Ajax" />
                <add namespace="System.Web.Mvc.Html" />
                <add namespace="System.Web.Routing" />
                <add namespace="System.Web.WebPages"/>
                <add namespace="Telerik.Web.Mvc.UI" />
            </namespaces>
        </pages>
    </system.web>
</configuration>
0
Nathan Smith
Top achievements
Rank 1
answered on 30 Jan 2012, 06:27 PM

I ran into this same problem and managed to get intellisense working by doing the following:

1. Start -> Programs -> Visual Studio -> Visual Studio Tools -> Visual Studio Command Prompt

2. From the command prompt type in

GacUtil /i *PATH_TO_DLL_REFERENCED_IN_PROJECT*\Telerik.Web.Mvc.dll

You should get the message "Assembly successfully added to the cache"

3. At the command prompt type in

GacUtil /l Telerik.Web.Mvc

You should get a message similar to the following:

The Global Assembly Cache contains the following assemblies:
  Telerik.Web.Mvc, Version=2011.3.1306.340, Culture=neutral, PublicKeyToken=121f
ae78165ba3d4, processorArchitecture=MSIL

4. Copy the assembly information from the command line into the VIEWS\Web.Config of your project in the section of
<system.web>
  <pages ...>
    <controls>

in the form of an <add assembly> line:

<add assembly="Telerik.Web.Mvc, Version=2011.3.1306.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4" namespace="Telerik.Web.Mvc.UI" tagPrefix="Tel" />

5. Add the above <add assembly> entry into the PROJECT's Web.Config under the section of
<system.web>
    <compilation ...>
      <assemblies>

but without the Namespace and tagPrefix attributes

<add assembly="Telerik.Web.Mvc, Version=2011.3.1306.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />

6. Make sure both Web.Config files have an entry under the section
<pages>
  <namespaces>

for

<add namespace="Telerik.Web.Mvc.UI"/>

Build your solution and you should be good to go.
0
Douglas
Top achievements
Rank 1
answered on 03 Apr 2012, 08:35 PM
I did all of this and Intellisense still doesn't work
0
IT Application Development
Top achievements
Rank 1
answered on 15 Jun 2012, 04:40 PM
this worked for me thanks!!!!
Tags
General Discussions
Asked by
Pavol
Top achievements
Rank 1
Answers by
Mario
Top achievements
Rank 1
Vir
Top achievements
Rank 1
Gregory
Top achievements
Rank 1
Georgi Tunev
Telerik team
Daniele
Top achievements
Rank 1
savo dev
Top achievements
Rank 1
Nathan Smith
Top achievements
Rank 1
Douglas
Top achievements
Rank 1
IT Application Development
Top achievements
Rank 1
Share this question
or