The term 'Update-Database' is not recognized as the name of a cmdlet

I am using EF5 beta1 and while I was able to run the "Update-Database" before. Now that I shut down Visual Studio, I cannot get it to run. I get the following error:

The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:16 + Update-Database <<<< -verbose + CategoryInfo : ObjectNotFound: (Update-Database:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

I have tried to re-install EF5b1 and while was successful (already installed), the 'Update-Database' still does not work.

Can anyone help???


The solution is to close the Package Manager Console, close Visual Studio and then reopen them.

Rebooting also worked most of the time, but not always.


If you use Entity Framework:

Error Message:

"Error Message (from the Update-Database command in the PMC): The term 'Update-Database' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Solution:

Exit Visual Studio. Reopen project and try again.

For more information please visit: Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12)


For anyone who is using .Net Core and EntityFrameworkCore:

You will need to install Microsoft.EntityFrameworkCore.Tools package to resolve this issue.

Read more here: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell


Reinstalling the nuget package fixed this issue for me

ie, execute

Install-Package EntityFramework -Version 5.0.0

in the package manager


Sometimes when I load VS, I see this in my package manager console:

Value cannot be null.

Parameter name: path1

I have no idea what causes that yet but it seems that something goes wrong during the start-up of the Powershell console which interrupts the registering of specific modules, such as the EF powershell extensions. You can just manually load it however:

Import-Module .\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1

Make sure you replace 6.1.1 with whatever your current version of Entity Framework is.