I am trying to update my app from netcore3.1 to net 6.0 but on initial migration I have following error
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see .....
I haven't change startup.cs and program.cs, see below
public class Program
{
public static void Main(string[] args)
{
var host = CreateWebHostBuilder(args).Build();
host.Run();
}
public static IHostBuilder CreateWebHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
and part of startup containing ApplicationDbContext
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
It was working well on netcore3.1 but now I can't initialize first migration