I have a fresh install of VS2012 with Update 2. I create a new project of "ASP.NET Dynamic Data Entities Web Application". I then add an "ADO.NET Entity Data Model" which I generate from an existing SQLServerExpress database.
However when I go to build the solution i get the following error:
The type or namespace name 'IObjectContextAdapter' could not be found (are you missing a using directive or an assembly reference?)
That appears to be declared in System.Data.Entity.Infrastructure
but I cannot find that assembly anywhere. I have verified that I have EF5 is installed for the solution as my packages.config shows:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
</packages>
The EntityFramework reference properties shows:
RuntimeVersion: v4.0.30319
Version: 5.0.0.0
and in web.config I have:
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>
This looks wrong as it should say 5.0.0.0? However changing it has no effect whatsoever. Can someone please point me in the right direction?
Getting this to compile turned out to be very easy. I needed to add:
using System.Data.Entity.Infrastructure;
to Global.asax.cs. Seems that the T4 template does not include this be default.
<%@ Import Namespace="System.Data.Entity.Infrastructure" %>
adding this line to the top of the global.asax works as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With