How to install EntityFramework 5.0 (and other older versions) from NuGet?
Asked Answered
P

3

38

I installed EF 5.0 into the .DAL, now I want to install EF 5.0 into .BLL from Nuget

But the default online Nuget package always comes up with 6.0, which gives error when used together with the 5.0 EF I use in DAL.

Where can I install the 5.0 version of EntityFramework into my Nuget packages??

Perrie answered 13/11, 2013 at 14:55 Comment(0)
K
71

View -> Other windows -> Package Manager Console then run install-package entityframework -version 5.0.0.0.

Add -project <project.name> if you want to install it in a specific project.

Kendakendal answered 13/11, 2013 at 14:56 Comment(5)
@Perrie What explenation you need, devnull gave you all the that you need.Rechabite
@Freak_Droid he didn't knew how to find the command window, it is not shown by defaultKendakendal
@Perrie watch the messages you get as a result of your command. you must uninstall any existing version and also make sure that it's removed from packages.config (found in each project)Kendakendal
Also, make sure you have Microsoft and .NET selected in the Package Source: drop down (I had nuget.org and it wasn't finding version 5.0).Chief
use valid semantic version Install-Package EntityFramework -Version 5.0.0Julius
C
14

here is what I experienced: (before I begin... kudos to devnull for the answer).

I clicked on:

1) View -> Other windows -> Package Manager Console then ran

2) install-package entityframework -version 5.0.0.0.

The uninstall started, but then rolled back, as it detected I already had installed Entity Framework (EF) 6.0.2 ...

>PM> install-package entityframework -version 5.0.0.0

Installing 'EntityFramework 5.0.0'. You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=253898&clcid=0x409. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device. Successfully installed 'EntityFramework 5.0.0'. *****Install failed. Rolling back...***** install-package : Already referencing a newer version of 'EntityFramework'. At line:1 char:1 + install-package entityframework -version 5.0.0.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

So then I uninstalled the Entity Framework 6.0.2 and found it had a dependency that also needed to be removed... then I was finally able to uninstall the Entity Framework 6.0.2 and then add the Entity Framework 5.0.0.0

PM> uninstall-package entityframework -version 6.0.2 uninstall-package : Unable to uninstall 'EntityFramework 6.0.2' because 'AnotherFakeDbSet 3.0.0.0' depends on it.

So then I uninstalled these two and installed Entity Framework 5.0.0.0

PM> uninstall-package AnotherFakeDbSet -version 3.0.0.0

PM> uninstall-package entityframework -version 6.0.2

PM> install-package entityframework -version 5.0.0.0

I like the console... quicker than searching for the packages if you know the version #. And if you haven't checked out "Powershell" (the basis for the console -- I find it's time well spent - it allows for virtually unlimited automation)

Cottony answered 17/12, 2013 at 16:29 Comment(1)
@timothy - I hadn't thought of it like that, but kinda... except with this you know exactly what is causing the issue... with dll hell, various programs just stopped working and you had to find the exact program that overwrote your existing dll. But first I had to figure out what happened and exactly what dll hell was and that was before I even heard of a little thing called google... Trust me... this is better...Cottony
L
0

Older versions of Entity Framework or other similar packages can be installed using Package Manager Console only in earlier versions of Visual Studio (prior to 2015). In Visual Studio 2015 there is an option of manually selecting version before install but in Visual Studio 2010,2012 you need to use package manager console only.

Simple browse to the link Nuget Explorer and click on the specific entity version that you have to install.

You'll see that Studio automatically shows the Package Manager console code.

For example I was working on a project that required Entity Framework 4.1 So here was my code. Entity Framework Package Manager Console Command Snapshot

Lethia answered 6/7, 2016 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.