0

I have Visual Studio 2012 professional, nd i use to build web applications using these technologies:-

  • asp.net mvc4.
  • Entity framework version 5.

now i have installed an update to my visual studio to support asp.net mvc5, then i download this template http://www.campusmvp.net/blog/extended-template-for-asp-net-mvc-5-from-visual-studio-2012.

I have created a new asp.net mvc5 project based on the templete, but when i run the application i got this error:-

Assembly 'Microsoft.AspNet.Identity.EntityFramework, Version=1.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, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' c:\Users....\Documents\Visual Studio 2012\Projects\WebApplication3\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll WebApplication3

now inside my application web.config file i have the following:-

configuration>
  <configSections>

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

  </configSections>

which means i am using EF 5 so why it is trying to reference EF6 ?

1 Answer 1

1

The problem is that ASP.NET Identity is using Entity Framework 6 (because you're using the EF implementation of it). The easiest solution would be to update EF to version 6. Another way (but I wouldn't call it nice) is to add an assembly redirect. Keep in mind that this way can introduce other problems.

If you don't use ASP.NET Identity at all (which is in the template by default), you could also remove all references and the code in the template, which references Identity..

Sign up to request clarification or add additional context in comments.

10 Comments

Upgrading to EF6 has some impact. You'll need the appropriate NuGet package, ensure that System.Data.Entity.dll is removed, updating some namespaces and swapping EDMX models to code generation. In my opinion the last point is the hardest one if you use EDMX models.
Yes, got it. Are you using ASP.NET Identity in your old projects? If not, remove it from your project.
Ok, than I would guess that the projects reference in each other in some way. If you have two projects in one solution using two different versions of EF and they are not referencing each other, they should not get affected ... but if they reference each other you get an error similar to the one you described above. It would be helpful if you could share your project structure (and what projects references which version of EF) and how the projects are related to each other.
Then there should be no problem.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.