【问题标题】:Error Installing Entity Framework 6.0.1 From Nuget (This operation would create an incorrectly structured document.)从 Nuget 安装实体框架 6.0.1 时出错(此操作会创建结构不正确的文档。)
【发布时间】:2014-04-23 18:24:28
【问题描述】:

在我的 ASP.NET MVC 5 中,我需要使用实体框架。我尝试通过 Nuget 包安装最新的 Entity 框架,但出现以下错误。我已经粘贴了完整的 nuget 堆栈错误。我尝试了几种方法,例如卸载/安装 EF、手动添加 EF 引用等。但到目前为止没有一个工作,我已经失去了 2 天。

I have tried links similar to my problem here in this site and even that has not helped and hence starting new thread hoping that someone will help me here! 
Need help here...I am stuck.

Error stack:

Install-Package EntityFramework
Installing 'EntityFramework 6.1.0'.
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkID=320539. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 6.1.0'.
Adding 'EntityFramework 6.1.0' to EPP.
Successfully added 'EntityFramework 6.1.0' to EPP.
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.1.0'.
Successfully uninstalled 'EntityFramework 6.1.0'.
Install failed. Rolling back...`enter code here`
Install-Package : This operation would create an incorrectly structured document.
At line:1 char:16
+ Install-Package <<<<  EntityFramework
    + CategoryInfo          : NotSpecified: (:) [Install-Package], RuntimeException

【问题讨论】:

    标签: entity-framework


    【解决方案1】:

    升级实体框架时,app.config 或 web.config 文件将写入内容。检查您的web.config 文件。来自here 的错误是

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

    当行更改为时已修复

    <configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多