Search code examples
entity-frameworkasp.net-identity

Changed Entity Framework v6 to Entity Framework v4.4 - getting error


I have created an ASP.NET MVC application and my Entity Framework version is 6.0.0, but I want Entity Framework version 4.4.0.

I have referenced version $.4.0 dll and also changed the version in package.config.

I am getting this error:

"Severity Code Description Project File Line Error CS1705 Assembly 'Microsoft.AspNet.Identity.EntityFramework' with identity 'Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' which has a higher version than referenced assembly 'EntityFramework' with identity 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Final c:\users\navya\documents\visual studio 2015\Projects\Final\Final\Models\IdentityModels.cs

Please let me know where I have to make changes when I change my Entity Framework versions in my reference.


Solution

  • Simply put - you can't do that. Identity library was compiled against EF6 and it won't work with lesser version. Upgrade path from 4 to 6 lists breaking changes that will not let you use v4 in any scenario.

    You can get the source code, change EF version there, adjust source code to work with v4, build binaries, reference the binaries in your project directly without NuGet package => profit (or rather a step back and a maintenance nightmare)

    Or you can build your own implementation of IUserStore that relies on EF4 and make Identity use your implementation.

    Other than that you are out of luck. You shouldn't really use EF4, but I suspect this is not your decision to make.