Entity Framework Core – No design-time services were found

As referenced in this article you should add the design time DbContext. Add the following class to your project:

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace WebApplication8
{
    public class DesignTimeBMDbContext : IDesignTimeDbContextFactory<BMDbContext>
    {
        public BMDbContext CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder<BMDbContext>();
            // pass your design time connection string here
            optionsBuilder.UseSqlServer("<connection_string>");
            return new BMDbContext(optionsBuilder.Options);
        }
    }
}

After adding this class, EF CLI will use it for design time database creation and updates

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top