Today I kept getting this error in my Razor View. The error message said,

Could not load file or assembly ‘System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified

Solution :

To use an external Entity Framework model, (for example : embedded in a dll as a reference) with ASP.NET MVC 3/4 you must :

  • Add the following reference to your MVC project : System.Data.Entity (Version 4.0.0.0, Runtime v4.0.30319)
  • Add the following line in your web.config

config

<compilation debug="true" targetFramework="4.0">  
<assemblies>  
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />  
</assemblies>  
</compilation>

This solved my problem. Hope it does yours too. Cheers !