I’m running ASP.NET MVC 3 and I’m looking at a Edit view for my model. I’ve got a FullName property which I want to render as “Full name”.
Here’s the offending line(s):
<div class="display-label">
<%: Html.LabelFor(model => model.FullName, "Full name") %>
</div>
Now the intellisense shows that the overload exists – there are two signatures, the first taking just the Expression and the second taking both the Expression and the string to be displayed. However when I browse to the page I get the titled exception (‘no overload…’).
Anyone have any success using this overload, and any advice on what I might be missing?
Update: I’ve tried reinstalling MVC3 to no avail. However I have noticed this in the compiler output on the error page:
c:\Windows\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\
System.Web.Mvc.dll: (Location of symbol related to previous error)
Which indicates to me that I’m using MVC 2, not MVC 3.
What have I misconfigured, or why would my IIS be using MVC 2 rather than MVC 3? How can I fix this?
You should check your web config if this was an MVC 2 project at one point.
You might be referencing the correct version of the DLL in the project References but pulling in 2.0.0.0 in the web config when it runs…?
http://blog.devlpr.net/2010/07/27/upgrading-an-asp-net-mvc-2-project-to-asp-net-mvc-3/
In my MVC3 app: