While working on an application in .NET Core, I ran into the following issue when trying to create the initial migration scripts using the command dotnet ef migrations add InitialCreate:

Unable to create an object of type 'BookStoreDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728

The solution to the above error is to run the following command:

dotnet ef --startup-project ../Path_to_startup_project/  migrations add InitialCreate