gpt4 book ai didi

c# - 错误 : This operation would create an incorrectly structured document

转载 作者:太空狗 更新时间:2023-10-29 18:02:59 24 4
gpt4 key购买 nike

我一直在尝试安装 Entity Framework 6,但它总是返回错误

error: This operation would create an incorrectly structured document.

我已经卸载了对这个位置提到的每个 dll 的所有引用。 http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6

疯狂的是,我可以创建一个新项目,创建一个 webAPI 程序,并尝试添加 Entity Framework 6,但我得到了同样的错误,即使在删除了对 System.Data.Entity.dll 的所有引用之后 我已经做了几天,需要认真的帮助。

我该怎么做才能安装 Entity Framework 6?

注意:它只会将 find 安装到类库中,而不是 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

最佳答案

我遇到了同样的问题。事实证明,我正在将 EF 添加到我的一个非常古老的项目中,并且 web.config 为 <configuration /> 定义了这个命名空间。元素:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

删除命名空间声明 ( xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0") 有助于解决这个问题。

关于c# - 错误 : This operation would create an incorrectly structured document,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19964620/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com