I have a Class Library project based on .NET 6.
I'm trying to load a custom JSON configuration file, and either create/instance an IConfiguration instance based on that.
I installed Microsoft.Extensions.Configuration version 5.0.0
The below code is working for Microsoft.Extensions.Configuration version 3.0
But SetBasePath is not working anymore and I couldn't find the what is the new way?
How can I fix that?
public static IConfigurationRoot GetAppSettings()
{
var applicationExeDirectory = ApplicationExeDirectory();
var builder = new ConfigurationBuilder()
.SetBasePath(applicationExeDirectory)
.AddJsonFile($"appsettings.json", optional: false, reloadOnChange: true);
return builder.Build();
}