0

I have a ASP.NET MVC program, MVC4+EF5+.net4.0, I want to update to .net4.5. This program have 2 projects, one is library project, another is MVC web site project.

To the library project, I use NuGet update to .net4.5 and the latest EF6, the EF dll version is 6.0.0.0, this is correct.

However to the MVC web site project I update to .net4.5 and EF6, the EF dll version is 4.4, not the 6.0.0.0 version, when compile it have below errors.

Error 51 The type 'System.ComponentModel.DataAnnotations.MaxLengthAttribute' exists in both '\bin\Release\EntityFramework.dll' and 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll'

The project is changed to net4.5, why the EF still use the net4.0 version?

I find a post here says web.config not work at EF5 or EF6, but not clearly, is it something in the web.config cause it to use 4.4 version? EF 4.4 -> 5 “Multiple versions were encountered” in MVC4

I find a web.config setting looks like the root cause, however I set it to 4.5, still no luck.

<pages controlRenderingCompatibilityVersion="4.0">
Community
  • 1
  • 1
  • duplicate http://stackoverflow.com/questions/12368304/entityframework-5-use-dll-version-4-4-0-instead-5-0 – Max Jan 08 '17 at 13:32
  • Did you use NuGet to update both assemblies? – Gert Arnold Jan 08 '17 at 14:25
  • @MaxMokrousov, Not the same problem, I Update-Package not work, I remove the EF package and install it again, the project is .net 4.5 now, but it still install EF with version 4.4 instead of 6.0. – Felix Liang Jan 08 '17 at 16:47
  • @Gert, yes, I use NuGet. – Felix Liang Jan 08 '17 at 16:48
  • @FelixLiang, are you mean that you install explicit Install-Package EntityFramework -Version 6.0.0 command, and nugget just installs 4.4 instead? – Max Jan 09 '17 at 00:26
  • @MaxMokrousov, I have try GUI "Manage Nuget Packages", and try command "Install-Package EntityFramework", it install the latest EF, but the installed version base on .net4.0, not .net 4.5, although my project is changed to 4.5 – Felix Liang Jan 09 '17 at 01:05

0 Answers0