Tip: EF Command Error

If you are using Entity framework in Visual Studio, you might notice that EF’s cmdlet are not working in nuget console sometimes. It’s because EF module is not loaded in nuget console for some reasons.

Error Message

The term ‘update-database’ is not recognized as the name of a cmdlet, function, script file, or operable program. Che
ck 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 <<<< -script
+ CategoryInfo : ObjectNotFound: (update-database:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

image001

Solution

You can use the following command to import the EF module.


Import-Module C:\Work\branches\v1\src\packages\EntityFramework.5.0.0\tools\EntityFramework.psd1

Leave a Reply

Your email address will not be published. Required fields are marked *