Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IConfiguration' does not contain a definition for 'GetSection' and no accessible extension method 'GetSection #1

Open
mukaz4god opened this issue Dec 12, 2019 · 0 comments

Comments

@mukaz4god
Copy link

.Nte 3.0

public static void Main(string[] args)
{
Console.Title = "IdentityServer4";

        var host = CreateWebHostBuilder(args).Build();

        var config = host.Services.GetRequiredService<IConfiguration>();
        bool seed = config.GetSection("Data").GetValue<bool>("Seed");
        if (seed)
        {
            var connectionString = config.GetConnectionString("conn");
            Users.EnsureSeedData(connectionString);
        }

        host.Run();
    }

Severity Code Description Project File Line Suppression State
Error CS1061 'IConfiguration' does not contain a definition for 'GetSection' and no accessible extension method 'GetSection' accepting a first argument of type 'IConfiguration' could be found (are you missing a using directive or an assembly reference?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant