Aspnetcore.docs: Argument 2: cannot convert from 'Microsoft.Extensions.Configuration.IConfigurationSection' to 'System.Action'

Created on 17 Jun 2020  Â·  1Comment  Â·  Source: dotnet/AspNetCore.Docs

Hi,

I"m trying to configure my options. I'm trying to use the same method in the docs, but I get the error:

Argument 2: cannot convert from 'Microsoft.Extensions.Configuration.IConfigurationSection' to 'System.Action'

My code:

```
public static IServiceCollection AddCustomOptions(this IServiceCollection services, IConfiguration configuration)
{
services.Configure(configuration.GetSection(nameof(CommonSettings)));
return services;
}
````


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Not Triaged Source - Docs.ms

Most helpful comment

Sorry! Realised I needed to include the package "Microsoft.Extensions.Options.ConfigurationExtensions"

>All comments

Sorry! Realised I needed to include the package "Microsoft.Extensions.Options.ConfigurationExtensions"

Was this page helpful?
0 / 5 - 0 ratings