EDMX .NET 4.5 to 4.0?

不想你离开。 提交于 2019-12-01 06:44:49

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:

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

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

Note for those on VS 2012 there is a separate install that's required if you want to keep a .Net 4 project on edmx v3. Entity Framework 6 Tools for Visual Studio 2012 – Jeff Jan 27 at 2:09

The above comment from Pawel's answer fixed my problem. I am copying it out into its own answer so that people can find it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!