The EntityFramework package is not installed on project

asp.net MvcEntity FrameworkVisual StudioNuget Package

asp.net Mvc Problem Overview


I am having trouble getting the EF to install on my very simple project called 'Match' (just now learning MVC, better late than never). The general context here is that I created the Model class with only 2 fields and now I want to change the Model class to have a few more fields/properties. I have made the change in the Model class and am now trying to update the DB to match. I am trying to use Update-Database from EF to do that.

>PM> install-package EntityFramework 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'. Successfully added 'EntityFramework 5.0.0' to Match.

>Type 'get-help EntityFramework' to see all available Entity Framework commands.

>PM> Enable-Migrations Get-Package : A parameter cannot be found that matches parameter name 'ProjectName'. At C:\Users\Dave\Documents\Visual Studio 2010\Projects\Match\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:611 char:40

  • $package = Get-Package -ProjectName <<<< $project.FullName | ?{ $_.Id -eq 'EntityFramework' }
  • CategoryInfo : InvalidArgument: (:) [Get-Package], ParameterBindingException
  • FullyQualifiedErrorId : NamedParameterNotFound,NuGet.PowerShell.Commands.GetPackageCommand

>The EntityFramework package is not installed on project 'Match'.

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

Hopefully no-one is as stupid as me, but for the benefit of searchers:

One possibility for this error - In the Package Manager Console, there is a dropdown for 'Default Project'. If this is set incorrectly, you will get The EntityFramework package is not installed on project 'x'. Change the dropdown to your EF project and all is good again.

Solution 2 - asp.net Mvc

In my case, restarting the Visual Studio helped.

Solution 3 - asp.net Mvc

Just update NuGet to 2.x. EF 5.0 requires it.

Solution 4 - asp.net Mvc

I have just restarted Visual Studio and it worked.

Solution 5 - asp.net Mvc

In my case I had a project that for some reason did not have a Packages.config file. The result was I got the error mesage "The EntityFramework package is not installed on project xxxx".

To solve this simply add a Packages.config file and "Install-Package EntityFramework" then works.

Solution 6 - asp.net Mvc

In my projects I installed EntityFramework on them separately. Even though they all had the same version numbers on each project, it still didn't work. Resulting in the same error you get.

To fix this, I removed EntityFramework from all my projects and reinstalled it again.

Get-Project -all | Uninstall-Package EntityFramework

Next, you just reinstall it again.

Get-Project -all | Install-Package EntityFramework

Solution 7 - asp.net Mvc

In my case I install Microsoft.EntityFrameworkCore.Tools package in my project! problem fixed.

Solution 8 - asp.net Mvc

I have the same problem. I have added EFCore to a project that has installed EF6. so add-migration xx command performed with EF6 instated of EFCore and I get this error. removing EF6 and restarting Visual Studio solved my problem.

Solution 9 - asp.net Mvc

You will have to install the EF into your project. You can do that via Tools|Manage NuGet Packages, look under 'Installed' and click on 'Manage'. There you will see an option to install EF in your project. After that everything should work and modelchanges will be possible. It can take quite some time (in my case, it did!). Success! Peter

Solution 10 - asp.net Mvc

Open package manager console and select default project from dropdown in package manager console And Install entity framework using this command in command window.

install-Package Entityframework

Solution 11 - asp.net Mvc

I have experienced with that issue I solved it by just install Microsoft.EntityFrameworkCore.Tools nuget package

that package will Enable these commonly used commands: Add-Migration Drop-Database Get-DbContext Get-Migration Remove-Migration Scaffold-DbContext Script-Migration Update-Database

Solution 12 - asp.net Mvc

Try to update the Entity Framework Package, from the Nuget Package Manager of your project, that's solved my problem.

Solution 13 - asp.net Mvc

In My Case reinstall Entity Package and restart Visual Studio.

Solution 14 - asp.net Mvc

In my case the packages.config file was on disk but not in TFS.

Solution 15 - asp.net Mvc

This error can happen if the Entity Framework command's target project is unloaded in the Visual Studio solution (i.e. if you'd previously right-clicked the project in Solution Explorer and selected "Unload Project").

In this case, the solution is to load the project, then try running the Entity Framework command again.

Solution 16 - asp.net Mvc

should work if you are opening a project for the first time,

second click on the console project and "Set as stratup project"

Solution 17 - asp.net Mvc

install EntityFrameworkCore install EntityFrameworkCore.SqlServer And Then Close Visual Studio And reopen Problem Fixed

Solution 18 - asp.net Mvc

You can also clear cache NuGet in VS. resolved my problem

Solution 19 - asp.net Mvc

In my case, I have a Xamarin.Forms solution with three projects - Backend (for Azure Database connection), one common library, an iOS project and an Android project. The error messages that I have received were "The EntityFramework package is not installed on project ..." and "No context type was found in the assembly ...". I have solved it by setting Backend as my StartUp project and then by entering the commands in the following format in the Package Manager Console:

Enable-Migrations -ProjectName Backend -Verbose

and after that

add-migration -ProjectName Backend Initial

I hope that this is of help for someone :)

Solution 20 - asp.net Mvc

This problem can be related with conflict of two versions of EntityFramework and EntityFrameworkCore. For checking it, you can write: Get-Module in package manager console. If you see EntityFramework and EntityFrameworkCore together, you need to delete EntityFramework or dependecy that linked on EntityFramework. For searching dependency you can use search solution input in solution explorer. After deleting dependency or EntityFramework you need to restart project.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1016313View Question on Stackoverflow
Solution 1 - asp.net MvcJsAndDotNetView Answer on Stackoverflow
Solution 2 - asp.net MvcMargusView Answer on Stackoverflow
Solution 3 - asp.net MvcSeriousMakcView Answer on Stackoverflow
Solution 4 - asp.net MvcsteveView Answer on Stackoverflow
Solution 5 - asp.net MvcNigel FindlaterView Answer on Stackoverflow
Solution 6 - asp.net MvcJordecView Answer on Stackoverflow
Solution 7 - asp.net MvcAli YousefiView Answer on Stackoverflow
Solution 8 - asp.net MvcafsharView Answer on Stackoverflow
Solution 9 - asp.net MvcPeter KleinView Answer on Stackoverflow
Solution 10 - asp.net MvcMusakkhir SayyedView Answer on Stackoverflow
Solution 11 - asp.net MvcHendi Dwi PurwantoView Answer on Stackoverflow
Solution 12 - asp.net MvcpepitombView Answer on Stackoverflow
Solution 13 - asp.net Mvcmaryam ghoreishiView Answer on Stackoverflow
Solution 14 - asp.net MvcMaxView Answer on Stackoverflow
Solution 15 - asp.net MvcJon SchneiderView Answer on Stackoverflow
Solution 16 - asp.net MvcasliView Answer on Stackoverflow
Solution 17 - asp.net MvczolfaghariView Answer on Stackoverflow
Solution 18 - asp.net MvcFazikiView Answer on Stackoverflow
Solution 19 - asp.net MvcSoniaView Answer on Stackoverflow
Solution 20 - asp.net MvcYevhenii KovalenkoView Answer on Stackoverflow