Last night I was working on a MVC4 project. Utilizing Entity Framework 5’s new DBGeography when adding the field to the MVC view I received the following error:
Compiler Error Message: CS0012: The type 'System.Data.Spatial.DbGeography' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
To solve this an assembly reference needs to be added to the <system.web> in /View/Web.config. It should look like this.
<compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </assemblies> </compilation>
Restart the solution and things should be good.
Thank You!