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 initial
+ CategoryInfo : ObjectNotFound: (Add-Migration:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
just install Microsoft.EntityFrameworkCore.Tools package from nuget:
Install Microsoft.EntityFrameworkCore.Tools menually as given below
Right click on your project name which project want add reference Microsoft.EntityFrameworkCore.Tools.
i.Open your project.json file and Remove all Microsoft.EntityFrameworkCore.Tools references from dependencies and tools sections.
ii.Colse Package Manager Console and and restart your Visual Studio 2017,2019 etc.
iii.Add this code as given below
iv.Add under tools section
v. Restart again Visual Studio 2017,2019 etc.
vi.Open the PMC(Package Manager Console) and type
Changed the entry in tools to
And then ran dotnet restore. After the restore completed, Add-Migration worked normally.I hope you will do it.