I am using visual studio Mac 2022 Preview for the programming. Initially I am building my project from windows and its much easier for programming. Now I turned to MAC. My Solution is consider by 3 projects, One is a ASP.NET Core Web API and another is DataAccess Class Library and the last project in that solution is Model Class Library.
The Database migration is included in the DataAccess ClassLibrary and the connection string is placed in the WebApi project. When I tried to do add-migration (dotnet ef migrations add ‘migration-name’) I am getting the error. I have globally initialise the dotnet ef tool (dotnet tool install — global dotnet-ef).
Can any one help me to do the migration in a separate Class Library. If I get the step by process, it will be more helpful.
You have to add additional options to your add migration script.
dotnet ef migrations add ‘migration-name’ -s <startup project> -p <migration project>
Startup project would be your API project. Migration project would be data project.
There are more you can find useful.
Entity Framework Core tools reference - .NET Core CLI - Common Options