Fix: The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program.
I got the below error when I tried to run the add-migration command in my project.
"add-migration : The term 'add-migration' 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
+ add-migration InitialMigration
+ CategoryInfo : ObjectNotFound: (add-migration:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException"
I was not able to do migration due to this.
You would get this error when you run the add-migration command without installing Microsoft.EntityFrameworkCore.Tools NuGet package in your application. To fix this error, follow the steps below.
- Go to Tools -> NuGet Package Manager -> Manage NuGet Packages For Solution
2. Select Browse tab and type "entityframeworkcore.tools" into the search box and select Microsoft.EntityFrameworkCore. tools when it appears, select your project name and click install
3. When the License Acceptance window appears, click "I Accept" button
Once you install Microsoft.EntityFrameworkCore. tools package, the issue will be fixed.