Visual Studio 2013 创建 EDMX 文件时出错

Visual Studio 2013 error creating an EDMX file

在 Visual Studio 2013(更新 2,以及后来的更新 4)中,使用 Entity Framework 6.1.2,我在创建 EDMX 文件时遇到问题。

创建文件时,我添加了一个新项目 select "ADO.NET Entity Data Model",而不管我创建的是 "Empty EF Designer model" 还是 "EF Designer from database"(也不管是哪个如果建立数据库,我可能会选择数据库)我收到一条非常普遍的错误消息:

"Operation is not valid due to the current state of the object"

它让我回到添加新项目向导。 *.edmx 已生成,但如果我尝试打开生成的 *.edmx 文件,我会收到另一条通用消息:

"The operation could not be completed."

*.designer.cs 文件似乎已填充,但并非所有程序集引用都已添加到项目中; System.Data.Entity 必须手动添加以引用 System.Data.Objects 才能解决。

我已经为 Visual Studio 2012 和 2013 安装了 Entity Framework 6 个工具,适用于 Visual Studio 的两个版本。我已经尝试对绑定到 TFS 和未绑定的项目执行此操作,并且在任何一种情况下错误仍然存​​在。

如果我在 Visual Studio 2012 年打开解决方案,同样的错误仍然存​​在。我在Visual Studio 2010添加一个*.edmx文件成功,然后稍后在Visual Studio 2013打开项目,*.edmx文件是存在且可访问;它打开并且我可以查看它,但是如果我移动或编辑,我会收到以下错误:

"XmlModels involved in this transaction are not editable."

有没有人对此有任何建议,或者我的环境中可能缺少什么?我对我的系统设置不当感到茫然。

根据错误 "XmlModels involved in this transaction are not editable",我找到了对类似问题的回复:

Entity Framework Unable to refresh database tables under TFS 2010

简而言之,我的项目和解决方案存储在磁盘 C:\Code\C#\Application\[etcetera]

问题出在 solution/project/file 路径中的“#”字符。快速将解决方案复制到 C:\Code\CSharp\[etcetera] 解决了添加和编辑现有 *.edmx 文件的问题。

我正在回答 preserve the Wisdom of the Ancients