In ASP.NET MVC 4.5.2 Framework.
after typing
@Html.LabelFor()
or
@Html.EditorFor()
in view
I\'m getting Error: The
I faced the same problem. Basically the problem is using different version of System.Web.Mvc
. So the best thing you should the open Tools > Nuget Package Manager > Manage Nuget Packages for Solution
. You can probably see System.Web.Mvc
on the Cosolidate
tab. Upgrade or downgrade would be the best option. If you use the latest .Net framework, which is currently .Net 4.6.1
, you should upgrade the all System.Web.Mvc
versions to 5.2.4.0
. Good luck!
Try to add
using system.Linq.Expressions;
I had this problem too.
Changing targetFramework="4.5.2"
to targetFramwork="4.5"
in web.config file solved it.
Restarting Visual studio worked for me.
This error means that Visual Studio is unable to locate the System.Web.Mvc assembly to power its intellisense for Razor views. One or both of the following may be required to fix it.
[root]/Web.config:
<system.web>
<compilation targetFramework="4.6" />
Project Properties:
[views folder]/web.config:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
MVC Assembly Reference Properties:
delete bin, .vs and obj directory. after build your project on the visual studio.