15
votes

Currently I have Entity Framework 5.0 installed in Visual Studio 2012. For some reason the project only is supported by EF 4.4.0.0.

So I installed EF 4.4.0.0 but I have the error in the Nuget command line:

PM> Install-Package EntityFramework -Version 4.4.0.0 Install-Package : Unable to find version '4.4.0.0' of package 'EntityFramework'. At line:1 char:1 + Install-Package EntityFramework -Version 4.4.0.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

PM>

3
Version 4.4.0 doesn't exists nuget.org/packages/entityframeworkJaider

3 Answers

26
votes

The versioning headache you are seeing is due to differences in what EF can support depending on what version of the .NET run time your app is targeting.

If you are targeting .NET 4 and install EF 5, the assembly version will be 4.4

If you are targeting .NET 4.5 and install EF 5, the assembly version will be 5.0

This is because things such as DBGeography only can work if .NET 4.5 is present.

Just install EF 5 proper and the NuGet package will figure this out and give you the proper version.

8
votes

tl;tr When you need assembly version 4.4.0.0 on .NET 4.0, just type into Package Manager Console:

PM> Install-Package EntityFramework -Version 5.0.0.0
6
votes

OK, so the deal here is that EF 5 is only supported by .net 4.5 projects (ie no .net 4). However if you have a .NET 4 project and try to install EF 5 what they do is give you another binary (called EF 4.4) which runs with .NET 4.

This means all you need to do is install the EF 5 package and you will get the correct (4.4) version of EF.

For a little more info from the EF team see http://brice-lambson.blogspot.ca/2012/10/unicorn-myths-debunked-entity-framework.html