IConfiguration does not contain a definition for GetValue. Typically appears when you're using IConfiguration outside of an Asp.Net Core app. In fact, GetValue is an extension method, so the solution is to simply add the following package: 1. Install-Package Microsoft.Extensions.Configuration.Binder.
Fix: 'ConfigurationBuilder' does not contain a definition for 'SetBasePath' To fix this error, you will have to install a new NuGet package Microsoft. Extensions. Configuration. Json .
The IConfiguration is an interface for . Net Core 2.0. The IConfiguration interface need to be injected as dependency in the Controller and then later used throughout the Controller. The IConfiguration interface is used to read Settings and Connection Strings from AppSettings. json file.
Install the NuGet package:
Microsoft.Extensions.Configuration.Binder
Duplicate: Bind an IConfigurationSection to a complex object without ASP.NET Core
The Get method does not exist anymore. You have to use:
Configuration.GetSection("key").Value.ToString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With