Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EDMX .NET 4.5 to 4.0?

We're using the Entity Framework and we created our EDMX when our project was set to build .NET 4.5. Now we want to switch to .NET 4.0 but when we do, we get compilation errors for the EDMX file.

It states the following error:

Error 10027: The XML namespace for the conceptual model's schema element is not supported on this project's target framework version.

Is there any solution other than recreating the EDMX file?

like image 766
firebird Avatar asked Feb 16 '23 07:02

firebird


2 Answers

Assuming you don't use features that shipped with .NET Framework 4.5 (enums, spatial types, stored procs with multiple result sets) you can do the following (be sure to back the file up just in case):

  • Create a new console app targeting .NET Framework 4.5
  • Add the edmx file to the project
  • Retarget the project to target .NET Framework 4 (go to project properties, change target framework version)

This should result in downgrading your edmx to v2.

Alternatively you could manually change xml namespaces and versions to v2. You can find what namespace to use for each version of the artifact here:

  • edmx
  • csdl
  • ssdl
  • msl

Edit Note that with EF6/EF6.x you can use Edmx v3 on .NET Framework 4 and therefore get all the goodnes (like enums) that was before only available on .NET Framework 4.5

like image 117
Pawel Avatar answered Feb 17 '23 22:02

Pawel


For what its worth I switched the target framework back to 4.5, recompiled the solution, got a bunch of errors, switched it back to 4.0 and got the message:

"Successfully rebuilt the edmx for the new target framework"

From there I was able to recompile without any namespace errors shrug

like image 31
Bauhaus Avatar answered Feb 17 '23 21:02

Bauhaus