Fil*_* DO 8 c# asp.net-web-api entity-framework-6
我一直在尝试安装实体框架6,它总是回滚错误
error: This operation would create an incorrectly structured document.
Run Code Online (Sandbox Code Playgroud)
我已经卸载了对这个位置提到的每个dll的所有引用.http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6
疯狂的是,我可以创建一个新项目,创建一个webAPI程序,并尝试添加实体框架6,我得到相同的错误,即使删除所有对System.Data.Entity.dll的引用后我已经是一些这几天,需要认真的帮助.
我该怎么做才能安装Entity Framework 6?
注意:它只会安装到类库而不是WebApi或MVC应用程序.
如果它有帮助,这里有一些更详细的错误信息.
PM> Install-Package EntityFramework -Version 6.0.0
Installing 'EntityFramework 6.0.0'.
Successfully installed 'EntityFramework 6.0.0'.
Adding 'EntityFramework 6.0.0' to AC.
Successfully added 'EntityFramework 6.0.0' to AC.
System.InvalidOperationException: This operation would create an incorrectly structured document.
at System.Xml.Linq.XDocument.ValidateDocument(XNode previous, XmlNodeType allowBefore, XmlNodeType allowAfter)
at System.Xml.Linq.XDocument.ValidateNode(XNode node, XNode previous)
at System.Xml.Linq.XContainer.AddNodeSkipNotify(XNode n)
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)
at System.Xml.Linq.XContainer.Add(Object content)
at System.Data.Entity.Migrations.Extensions.XContainerExtensions.GetOrCreateElement(XContainer container, String elementName, XAttribute[] attributes)
at System.Data.Entity.ConnectionFactoryConfig.ConfigFileManipulator.AddOrUpdateConfigSection(XDocument config, Version entityFrameworkVersion)
at System.Data.Entity.ConnectionFactoryConfig.InitializeEntityFrameworkCommand.<>c__DisplayClass3.<Execute>b__1(XDocument c)
at System.Data.Entity.ConnectionFactoryConfig.ConfigFileProcessor.ProcessConfigFile(ProjectItem configItem, IEnumerable`1 manipulators)
at System.Data.Entity.ConnectionFactoryConfig.InitializeEntityFrameworkCommand.<>c__DisplayClass3.<Execute>b__0(ProjectItem i)
at System.Data.Entity.ConnectionFactoryConfig.ConfigFileFinder.FindConfigFiles(ProjectItems items, Action`1 action)
at System.Data.Entity.ConnectionFactoryConfig.InitializeEntityFrameworkCommand.Execute()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Uninstalling 'EntityFramework 6.0.0'.
Successfully uninstalled 'EntityFramework 6.0.0'.
Install failed. Rolling back...
Install-Package : This operation would create an incorrectly structured document.
At line:1 char:16
+ Install-Package <<<< EntityFramework -Version 6.0.0
+ CategoryInfo : NotSpecified: (:) [Install-Package], RuntimeException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Run Code Online (Sandbox Code Playgroud)
Ant*_*nek 18
我有同样的问题.事实证明,我正在为我的一个旧项目添加EF,web.config为<configuration />元素定义了这个命名空间:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
Run Code Online (Sandbox Code Playgroud)
删除该命名空间声明(xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0")有助于解决此问题.
我遇到了同样的问题,并发现原因是web.config文件中的元素.在我的情况下,我改变了这个:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
Run Code Online (Sandbox Code Playgroud)
对此:
<configuration>
Run Code Online (Sandbox Code Playgroud)
修好了.
当实体框架升级时,app.config 或 web.config 文件将写入内容。我怀疑这可能是问题所在。查看您的 app.config 或 web.config 文件。也许 EF 升级在写入它们时遇到问题,而不会生成无效的 xml 文档。
| 归档时间: |
|
| 查看次数: |
3399 次 |
| 最近记录: |