Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Improved formatting
Source Link
Ciarán Bruen
  • 5.4k
  • 13
  • 64
  • 70

Suderson's solution worked for me when modified as below:

 var builder = new ConfigurationBuilder()   .SetBasePath(Directory.GetCurrentDirectory())   .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)   .AddEnvironmentVariables();   IConfiguration config = builder.Build();   //Now, You can use config.GetSection(key) to get the config entries 

Suderson's solution worked for me when modified as below:

 var builder = new ConfigurationBuilder()   .SetBasePath(Directory.GetCurrentDirectory())   .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)   .AddEnvironmentVariables();   IConfiguration config = builder.Build();   //Now, You can use config.GetSection(key) to get the config entries 

Suderson's solution worked for me when modified as below:

var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddEnvironmentVariables(); IConfiguration config = builder.Build(); //Now, You can use config.GetSection(key) to get the config entries 
Source Link
Bob Ash
  • 895
  • 10
  • 12

Suderson's solution worked for me when modified as below:

 var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddEnvironmentVariables(); IConfiguration config = builder.Build(); //Now, You can use config.GetSection(key) to get the config entries