Intellisense errors with HtmlHelper.LabelFor() & latest Orchard version

Topics: Core, General, Writing modules
Sep 11, 2012 at 11:35 AM

Trying to use this in my Address.cshtml view:

LabelFor(m => m.Street, T("Address Line 1").ToString(), new { @class="control-label"})

It compiles and runs fine, but I get the wavy red underlining that comes with Intellisense errors for all places where I use this overload, with the message "No overload for method 'LabelFor' takes 3 arguments. 

if I do "Goto definition...", the 'find symbol' pane lists overloads from system.web.mvc.dll from mvc 3.0: 

LabelFor(this global::System.Web.Mvc.HtmlHelper, global::System.Linq.Expressions.Expression>) - c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll

There are none listed for 4.0. It works but it's a little annoying if you are trying to use intellisense to find a specific method overload to use. To fix this would we have to update all references to system.web.mvc.dll from 3.0 to 4.0? I Know the runtime binding is set to 4.0, but there are still references in the web.config's to 3.0, which I think might be throwing off VS2010? 

Sep 12, 2012 at 5:01 PM

The problem is that the project is not an MVC project. You can add that to the csproj file if you want, but then you'll get errors on machines that don't have the full MVC installed.