IConfiguration does not contain a definition for GetValue
Just install Microsoft.Extensions.Configuration.Binder
and the method will be available.
The reason is that GetValue<T>
is an extension method and does not exist directly in the IConfiguration
interface.
The top answer is the most appropriate here. However another option is to get the value as a string by passing in the key.
public string BaseUri => _configuration["ApiSettings:ApiName:Uri"] + "/";