解决方案
config.SetBasePath(GetBasePath());
config.AddJsonFile("appsettings.json", false);
private string GetBasePath()
{
using var processModule = Process.GetCurrentProcess().MainModule;
return Path.GetDirectoryName(processModule?.FileName);
}
标签:core,appsettings,json,file,net,config
From: https://www.cnblogs.com/trykle/p/17613052.html