Try our conversational search powered by Generative AI!

Intellisense problem razor episerver 7


I'm learning EpiServer 7 built on MVC and am now trying to make the PropertyFor work as I want it. I have a property called title and if I write it like this (code below), it renders correctly but I dont't get any intellisense for the Linq expression inside (the x). You see what namespaces I am using and I have also added System.Linq in the webconfig for views. What do I need to do to get intellisense?


@using System
@using System.Data
@using EPiServer.Cms
@using EPiServer.Core
@using EPiServer.Web.Mvc.Html

@model MyApplication.Models.Pages.StartPage

<h2 class="@Html.EditAttributes(x => x.Title)">
    @Html.PropertyFor(x => x.Title)

Note. The alloy MVC demo site have this problem for me as well so can't find any good solution there. I can't add System.Linq in the razor page, the page can't find the reference.



Jul 02, 2013 11:58

Do you have ReSharper installed?

Jul 02, 2013 16:25

I don't have ReSharper installed, if it's possible to solve it without having to buy a product it would be great since I don't use my private computer for business.

How come I need ReSharper? Html.EditorFor(), Html.TextBoxFor() and so onworks with intellisense and I have never had and issues with razor intellisense when programming...?

Jul 02, 2013 17:01

not sure if this apply to mvctemplates but make sure you have tagprefix for episerver as well as standard .net in web.config. if you do not have those it might not work. same goes for standard .net.

Jul 02, 2013 20:46

Hmm, After testing a little I realize that not even Html.TextBoxFor(linq-epression) has intellisensse as well as basix ViewBag.DynamicEpression. It feels like this might not be an epi-issue but more of an issue when I merged the epiinstallation and an empty mvc 4 project.

Jul 02, 2013 21:52

I think it had to do with the merging of the two projects. I changed the project's target frameowrk from 4.0 to 4.5 and it now works like a charm :)

Jul 02, 2013 22:05

moste of the time when you do not have intellisens visual studio complain about the web.config. There is a section in web.config that tell vs the libraries you should have intellisense for. you could also add your own code to that section. it is almost like when you add user controls in top of your webforms document in webforms applications. Have a look at an empty web.config from that comes with the empty episerver vs integrations installation.

Jul 02, 2013 22:06

it should not matter if you change the target framework since episerver standard is .net 4.0. I google a bit and Microsoft confirmed a bug as well for MVC 4 A restart might help as well. The section in web.config should look something like this for ordinary MVC support

        <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="System.Web.Helpers" />


Edited, Jul 02, 2013 22:09

I couldn't remember where I found this solution, but it worked for me. You need to add targetFramework=4.0 in you web.config under compliation section

<compilation defaultLanguage="c#" optimizeCompilations="true" debug="true" targetFramework="4.0">



Jul 03, 2013 16:57

What I learned from this, target framework in project and in webconfig must be the same. Apperantly they were not when merging the two projects. Thank you all for your help!

Jul 04, 2013 20:52

I can concurr to Andreas last statement.  Helped me anyway :)

Jan 29, 2014 9:25

I had to add the following keys to appsettings in web.config to get the intellisense up and running

<add key="webpages:Version" value="" />
<add key="webpages:Enabled" value="false" />




Feb 04, 2014 13:56

Intellisense is working for me with these two changes



<add key="webpages:Version" value="" />
<add key="webpages:Enabled" value="false" />


May 07, 2014 9:50
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.