error: This operation would create an incorrectly structured document

后端 未结 6 1943
北海茫月
北海茫月 2020-12-09 21:40

I keep trying to install the entity framework 6 and it always rolls back with the error of

error: This operation would create an incorrectly structured docum         


        
相关标签:
6条回答
  • 2020-12-09 21:43

    I had the same problem, and discovered the cause was the element in the web.config file. In my case, I changed this:

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

    to this:

    <configuration>
    

    That fixed it.

    0 讨论(0)
  • 2020-12-09 21:56

    I had the same problem. It turned out that I was adding EF to one of my really old projects and web.config had this namespace defined for <configuration /> element:

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

    Removing that namespace declaration (xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0") helped and solved this issue.

    0 讨论(0)
  • 2020-12-09 21:57

    When Entity Framework is upgraded, the app.config or web.config files will get stuff written into them. I suspect that might be the problem. Take a look at your app.config or web.config files. Maybe the EF upgrade is having trouble writing to them without making an invalid xml document.

    0 讨论(0)
  • 2020-12-09 22:05

    In a web app, web.config had a reference to external app.config:

    <appSettings configSource="App.config" />

    This requires the App.config to be in a particular format, that EntityFrameworks installer considers invalid

    So, like others, the key was to:

    • rename/delete the App.config

    • Install EF

    • bring back the App.config

    0 讨论(0)
  • 2020-12-09 22:08

    It is to do with your configuration files. Just to detail the solution I found:

    First save your app.config, packages.config and web.config

    Then delete them all. I actually deleted app.config and packages.config and just cleared out the lines between and in the web.config.

    Then I ran the Install-Package again, all went well, then I added back in my configuration.

    0 讨论(0)
  • 2020-12-09 22:09

    I had the same issue and I modified my web.config from

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

    To

    (<configuration>)
    
    0 讨论(0)
提交回复
热议问题