ahmed gaber
ahmed gaber

Reputation: 77

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?

Upvotes: 0

Views: 811

Answers (2)

Steffen Cole Blake
Steffen Cole Blake

Reputation: 636

You might be missing the nuget package, if thats not the case also double check you have the powershell interface in Visual Studio pointing at the correct project (You want the one where your DbContext object exists and is defined)

enter image description here

Upvotes: 0

Karney.
Karney.

Reputation: 5031

This error indicates that one package is missing.

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

Upvotes: 3

Related Questions