I've recently started work on an MVC 5 application, and have run into a head-scratcher regarding intellisense in my Razor views. I think this image sums up the problem quite well (apologies for tiny size, please right click and open in new tab or read transcript below):
For those of you who can't see this clearly, my invocation of Html.ActionLink("Create new", "Create")
, results in the IDE complaining about the following:
'System.Web.WebPages.Html.HtmlHelper'
does not contain a definition forActionLink
, and the best extension method overload'System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string)'
has some invalid arguments
But clearly, if I pass two strings to an extension method of System.Web.Mvc.HtmlHelper
, this exactly matches the required signature {{extensionmethod}}(System.Web.Mvc.HtmlHelper, string, string)'
. What is the problem here?
Oddly enough this is only affecting Intellisense; the view compiles and runs just fine. I found a few links that suggest Visual Studio 2012 (which I am using) has trouble with Razor 3 intellisense. The accepted solution is to install Web Tools 2013, which I've already done. Restarting the IDE showed no difference.