0

Trying to use Visual Studio 2012, Entity Framework 5.0 database first approach to generate my edmx.

When I generate the EDMX from the database VS 2012 - says

Successfully registered the assembly 'System.Data.Entity, Version=4.0.0.0;

web.config file as well says

<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral.../>
  1. I see EntityFramework and System.Data.Entity both listed in the references. EntityFramework shows up in the packages folder and System.Data.Entity points to the .NET 4.5 install folder. Does this mean that I am succesfully using EF 5.0?

  2. For existing project migrations - when I migrate a project from VS 2010 .NET 4.0 and set the .NET client profile to 4.5 the System.Data.Entity assembly gets upgraded to the one in .NET 4.5 install folder. I do not see the EntityFramework.dll at all. Are there any changes I would need to make in order for my existing project to mgirate to EF 5.0 and .NET 4.5

Am I missing something here?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user275157
  • 1,332
  • 4
  • 23
  • 45

1 Answers1

0

The version of System.Data.Entity.dll assembly is the same on both .NET Framework 4 and .NET Framework 4.5. The catch is that only one version can be installed on a machine at the same time so even if you target .NET Framework 4 in your project but run your app on a machine with .NET Framework 4.5 you will effectively run it against .NET Framework 4.5 (and therefore the EF5 version of System.Data.Entity.dll assembly). With regards to EntityFramework.dll - up to the version 6 it was build on top of System.Data.Entity.dll (in EF6 the code from System.Data.Entity.dll and EntityFramework.dll was merged and further evolved). If you used EntityFramework.dll in VS2010 it means that it had to be one of the 4.x versions which were EF4. You could continue to use it even with the EF5 version of System.Data.Entity.dll but you will not be able to take the advantage of new features introduced in EF5 (like enums, spatial etc.). Since you decided to move to .NET Framework 4.5/EF5 you should also update your EntityFramework.dll 5.0.0.0. To do that you have to install the NuGet extension (http://docs.nuget.org/docs/start-here/installing-nuget) if you have not already and just install EntityFramework.dll using the package manager console (http://www.nuget.org/packages/EntityFramework/5.0.0). It should replace the 4.x version you have in your project with 5.0.

Pawel
  • 31,342
  • 4
  • 73
  • 104
  • Thanks for the reply. I did not use the EntityFramework.dll in VS2010. I see both EntityFramework.dll and System.Data.Entity in my VS 2012 project built with .NET 4.5 client profile. nuget tells me I have ef 5.0 installed already. However the config file when I generate an edmx still says System.Data.Entity version 4.0.0 (my 1st question). Should it not say 4.5? Any suggestions would be greatly appreciated. – user275157 Aug 14 '13 at 04:05
  • No, because .NET Framework 4.5 is an in-place update and assembly versions did not change and will be 4.0.0.0 in both cases. If you want to check whether a given assembly is a .NET Framework 4 or .NET Framework 4.5 you will need to check the file version - it will be 4.0.30319.1 for .NET Framework 4 and 4.0.30319.17929 for .NET Framework 4.5 – Pawel Aug 14 '13 at 05:06