The type 'Expression<>' is defined in an assembly that is not referenced

In ASP.NET MVC 4.5.2 Framework.

after typing

@Html.LabelFor()
or 
@Html.EditorFor()

in view

I'm getting Error: The type 'Expression<>' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I have added assembly reference System.Core.dll, Version 4.0.0.0, Runtime Version v4.0.30319. and also i did in web.config


I am not sure if you are still having this issue or not but i was having the same issue as well.

I was able to find the solutions here

https://stackoverflow.com/questions/6496223/compilation-error-in-net-4-0-web-config-linq-not-found

<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

I hope this helps..


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.

  1. Ensure the version of the .NET framework for the compilation property in the main web.config (the one in the website root) is the same as that specified in the project properties.

[root]/Web.config:

<system.web>
    <compilation targetFramework="4.6" />

Project Properties:

Project Properties

  1. Ensure the version of the MVC assembly specified in the views web.config (the one in the views folder) is the same as the MVC assembly you are using in your project.

[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:

MVC version


I have run in the same issue as you, albeit much later. The issue was that I was not able to access Razor views (.cshtml) as I was getting an error stating that I had a missing assembly reference, namely System.Web.Mvc, even though it was in the project references. After investigation, I have noticed that the installed NuGet version was 5.2.3, while the project required 5.2.0. The solution is to downgrade the MVC version.

  1. Go to Project-> NuGet Package Manager.
  2. Search for MVC; it's going to be the first result.
  3. Next is to select downgrade from the drop-down in the details of the NuGet package and submit.

Confirm all the dialogs and you are ready to go.