Build error when using VS 11, .NET 4.5 and Entity Framework

佐手、 提交于 2020-01-13 09:16:49

问题


In Visual Studio 2010, my solution was using .NET 4.2 (Entity Framework June 2011 CTP) so I could use spatial types in Entity Framework. When I upgraded to Visual Studio 11 Beta, it wouldn't build because of conflicts between the 4.2 and 4.5 framework so I uninstalled 4.2. Now I get this error when I build:

Error 209: Currently, spatial types are only supported when used in CSDL files that have the UseStrongSpatialTypes annotation with a false value on their root Schema element.

Anyone know what this means and what I can do about it? Google yields literally zero results ...


回答1:


Manually editing the .edmx file worked for me. Open the file in text or XML editor(you can right click and open with...)

Go to Schema node in ConceptualModels and change this:

<edmx:ConceptualModels>
    <Schema Namespace="MyDataModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
    ...

to add the attribute, like so:

<edmx:ConceptualModels>
  <Schema Namespace="MyDataModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"  xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false">

It is quite annoying this attribute is not editable.




回答2:


Set UseStrongSpatialTypes to false in the root properties in the EF designer window.



来源:https://stackoverflow.com/questions/9792558/build-error-when-using-vs-11-net-4-5-and-entity-framework

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