How to enable migrations in Visual Studio for Mac

franswa picture franswa · Jul 28, 2017 · Viewed 21k times · Source

I have Visual Studio for Mac and I'm trying to learn Xamarin with Azure using the following tutorial: https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter3/server/

At some point, I have to enable EF migrations. The tutorial says: Go to View -> Other Windows -> Package Manager Console.

Unfortunately there is no Package Manager Console in Visual Studio for Mac... so how do you handle things like enable-migrations, add-migration or update-database on the Mac?

Answer

J T picture J T · Sep 20, 2019

To run EF on Mac just follow the following.

Open a command line, go to the project folder, and run

dotnet restore

If everything is fine, you should be able to run

dotnet ef

After that you can run commands like:

dotnet ef migrations add initial

dotnet ef database update