Search code examples
asp.net-coreentity-framework-coredatabase-migrationentity-framework-migrationsvisual-studio-mac

cannot use add-Migration in .net core 2.1 project using visual studio for mac


I am using Visual Studio for Mac and have .NET Core 2.1 project. I have an issue when using any migration command like "Add-Migration", namely the following error occurs:

**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 DBUpdates -Context applicationdbcontext
 + ~~~~~~~~~~~~~
 + CategoryInfo         : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException
 + FullyQualifiedErrorId : CommandNotFoundException**

Any clue what the cause of this could be?


Solution

  • This error indicates that one package is missing.

    Install package Microsoft.EntityFrameworkCore.Tools from nuget. Then reopen the visual studio.