Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
9.2k views
in .Net Framework by 11 11 15

I created a web application and want to connect a web application with a SQL server, I run this command in Package Manager Console

PM> add-migration createDB

but I got this error:

add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Chec
k 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
+ add-migration CreateDB
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

 


1 Answer

0 like 0 dislike
by 23 25 39
selected by
 
Best answer

The term 'add-migration' is not recognized as the name of a cmdlet

To solve this error, you need to install this package Microsoft.EntityFrameworkCore.Tools

  1. Open your Cmd and go to the path of the project folder, then run this command

     dotnet add package Microsoft.EntityFrameworkCore.Tools
    
  2. And then go to Visual Studio - Package Manager Console and run this command again

     PM> add-migration createDB
    
If you don’t ask, the answer is always NO!
...