Yes, it is possible that you want, but you have to do it manually (I do not know if there is an easy way).
Suppose you have some settings in appsettings.json as shown below:
{ "AppSettings" : { "Setting1": "Setting1 Value" } }
In the Startup.cs constructor set ConfigurationManager.AppSettings with the value:
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build();
And get the value in the class library:
var conStr = ConfigurationManager.AppSettings["Setting1"].ToString();
source share