Tuesday, May 10, 2022

The term 'scaffold-dbcontext' is not recognized as the name of a cmdlet, function, script file, or operable program

 Hello All when you want to execute the scaffold-dbcontext "Data Source=(local);Initial Catalog=MyDb;Integrated Security=True;" Microsoft.EntityFrameworkCore.sqlserver -outputdir Models


Gives this error.

scaffold-dbcontext : The term 'scaffold-dbcontext' 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:1

+ scaffold-dbcontext "Data Source=(local);Initial Catalog=MyDB;In ...
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (scaffold-dbcontext:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Solution:- The solution is as below 

For me apparently, it worked once I have also ran in the Package Manager console :


 Install-Package Microsoft.EntityFrameworkCore.Tools 



Thank you.

 

No comments:

Post a Comment