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

Viewed 24613

So randomly from one day to the next my migrations stopped working. I do add-migration and it says its not being recognized. I'm using PM since this is a asp.net mvc and was working the day before.

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.

enter image description here

9 Answers

This isn't exactly the issue the OP is having, but for dotnet core at least, this can also be caused by not having the Microsoft.EntityFrameworkCore.Tools nuget package installed, which is used for the package manager commands in Visual Studio and command line.

Even simpler for me, just re-starting VS2017 fixed this. Not had it until I got VS2017 professional, so this may be an issue for others in the latest version.

I reinstalled Nuget package manager and it worked for me. Fist I uninstalled the previous version, 2.0.x, then installed version 2.8.x

Ok, also we get the same error when "add-migration", i try one solution which is update Package Manager by using follow step

  1. In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option.
  2. From the dialog that appears, expand the "Updates" node from the tree at the left side.
  3. Select the "Visual Studio Gallery" option from the tree.
  4. Finally, look for the Package Manager update in the list of updates at the right side of the dialog and click the "Update" button beside it.

it is approx 5 - 10 MB update, after update complete try Get-Help Add-Migration

If you are facing this issue in Visual Studio for Mac then simply re-install Nuget Package Manager Console extension. It will solve your problem

Related