Make ‘dotnet ef‘ work with EF Core 2.0
EF Core 2.0 changed the way the CLI looks for the DBContext to use. There are now two ways: Invoke BuildWebHost  in Startup.cs Use the class implementing IDesignTimeDbContextFactory<T> BuildWebHost  is called even if a class implements IDesignTimeDbContextFactory<T>. Solution for this problem: Rename BuildWebHost  to e.g. _BuildWebHost  (making it private isn’t enough). Next step: create the class DesignTimeDbContextFactory : public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<ApplicationDbContext> {    public ApplicationDbContext CreateDbContext(string[] args)    {     IConfigurationRoot configuration = new ConfigurationBuilder()           .SetBasePath(Directory.GetCurrentDirectory())           .AddJsonFile("appsettings.json")           .Build();       var builder = ne...