find and solve || findandsolve.com
Please wait.....

The term “Add-Migration” is not recognized

The term “Add-Migration” is not recognized

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

Answer

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.



Another way

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

"Microsoft.EntityFrameworkCore.Tools": {

  "version": "1.0.0-preview2-final",
  "type": "build"
 }

iv.Add under tools section

"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"

v. Restart again Visual Studio 2017,2019 etc.

vi.Open the PMC(Package Manager Console) and type

Add-Migration $Your_First_Migration_Name$


OR

"tools": {

    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"  
}

Changed the entry in tools to

"tools": {

    "Microsoft.EntityFrameworkCore.Tools": {
    "version": "1.0.0-preview2-final",
    "type": "build"
  }
}

And then ran dotnet restore. After the restore completed, Add-Migration worked normally.I hope you will do it.

Mahira  khanna

Mahira khanna

I have the skills you need for you company blog, website, or other content materials

Comments



Report Response