Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
After I installed latest EntityFramework 4.3.1 to my MVC3 project, I decided to start using new Migrations feature.

But then, my project won't build and give this error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

There is a duplicate 'entityFramework' section defined

Config Source:

<configSections>
  <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>


So it builds and works fine when I disable this section in web.config:
<configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>


But when I disable it, and then I ran Enable-Migrations and then Add-Migration [Some_Name] to create an initial named migration, I get this error:
The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.


So my question is - is there a way to use Migrations without disabling/enabling configSection in web.config, or what I am missing?
Posted
Updated 3-Apr-12 5:50am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900