Entityframeworkcore erroring - not able to add migrations

Are you reading your appsettings properly?

Maybe you are missing

builder.Configuration
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables()
.Build();

in your Program.cs file.

Before you add the DBContext with "builder.Services.AddDBContext" write the piece of code from above. If you use this check if any nuget packages are missing as well.

For ".SetBasePath()" you need - "Microsoft.Extensions.Configuration.FileExtensions" and for ".AddJsonFile" you need " Microsoft.Extensions.Configuration.Json"

If this not work check the file settings of your "appsettings.json". Maybe your not copying your appsettings.json in your directory.