I recently developed a .net 4.5 library using Entity Framework 5. Everything worked fine until I've been told I had to downgrade to .net 4.0 in order to remain compatible with Windows 2003.
I uninstall EF 5 using the Package Manager Console and had the successfull message, then this one:
Failed to generate binding redirects for 'MyProjectName'. An item with the same key has already been added.
The same message appears after downgrading and installation of Entity Framework.
Everything compile. But on execution I've this exception:
The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.
Could not load file or assembly 'EntityFramework, Version=5.0.0.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference. (Exception from HRESULT:
0x80131040)":"EntityFramework, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
In the Web.Config (and App.Config of the libraries) I have those lines:
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
...
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Any help would be appreciated.