How to enable migrations in Visual Studio for Mac

This is currently supported on Mac.

First you need to install dotnet-ef

dotnet tool install --global dotnet-ef

To install a specific version of the tool, use the following command:

dotnet tool install --global dotnet-ef --version 3.1.4

Add the “dotnet-ef” tools directory on the PATH environment variable.

export PATH="$PATH:/Users/'your user folder'/.dotnet/tools"

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

PS: Your solution should not be executing when the dotnet ef command line is trying to run!!!

For People who are not convinced, here a demo of succeed!!!
For People who are not convinced, here a demo of succeed!!!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)