Upgrade to EF6 on .net4 - System.Data.MetadataException: Schema specified is not valid

entity-framework

Question

I have an asp.net website running under .net v4. I have upgraded from Entity Framework v5 to v6.02 and all worked fine running locally on IIS express and .net4 using the EntityFramework v4 dll provided by nuget.

I publish to my hosting company and get the error below. Upgrading to .net4.5 might help, but this is not an option on my provider at the moment.

Any suggestions?

System.Data.MetadataException: Schema specified is not valid. Errors: BkkpsModel.csdl(2,9) : warning 0005: Could not find schema information for the attribute 'Namespace'. BkkpsModel.csdl(2,32) : warning 0005: Could not find schema information for the attribute 'Alias'. BkkpsModel.csdl(2,98) : error 0005: The 'http://schemas.microsoft.com/ado/2009/02/edm/annotation:UseStrongSpatialTypes' attribute is not declared. BkkpsModel.csdl(2,2) : error 0010: The element Schema in namespace http://schemas.microsoft.com/ado/2009/11/edm was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm, http://schemas.microsoft.com/ado/2007/05/edm, http://schemas.microsoft.com/ado/2008/09/edm.
1
6
1/16/2014 3:12:39 AM

Accepted Answer

You created an EDMX file with Entity Framework 6 but you using it with Entity Framework 5. Entity Framework 6 uses EDMX file with version 3.0 but Entity Framework 5 does not support it.

You must repair your EDMX file from version 3.0 to version 2.0

The easiest way to do that is open EDMX in Visual Studio 2012 project with Entity Framework 5 or older. The entity data model designer show error: unable to display file. The file references an XML namespace that is inconsistent with the target framework of the project. Than click the modify link and the designer automaticly repair your EDMX file.

OR:
1. open your EDMX file as XML Editor
2. change the following elements:

from:
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
to:
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">

from:
xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl"
to:
xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"

from:
xmlns="http://schemas.microsoft.com/ado/2009/11/edm"
to:
xmlns="http://schemas.microsoft.com/ado/2008/09/edm"

from:
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
to:
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">

... for all inconsistent xmlns
13
1/18/2014 8:23:48 AM

Popular Answer

Another way of achieving what Cyrus said (downgrading from edmx v3 to ednx v2) is in the answer for another question:

EDMX .NET 4.5 to 4.0?



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow