Fixing MVC 5 Intellisense false errors (erroneous errors) ๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜–

This one really had me scratching my head.

My error was looking similar to this stack overflow post – like this:

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

Here is what worked for me…

Locate the Web.Config in the root of your project (not the one in the views folder)

You want to find the following line:

<compilation targetFramework="4.5" debug="true"/>

Change it to the following:

<compilation targetFramework="4.5" debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>

Once that is done, close your project, and delete the .vs folder from the solution.

Re open visual studio and viola!

I hope these steps helped restore your intellisense issues.๐Ÿ˜Ž


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *