C# 11 ConfigurationManager not reading appsettings.json values in ASP.NET Core 7
Can someone help me understand I've looked through the documentation and I'm still confused about I've been struggling with this for a few days now and could really use some help..... Could someone explain I tried several approaches but none seem to work. I've looked through the documentation and I'm still confused about I'm experiencing an scenario where my ASP.NET Core 7 application is not picking up values from the `appsettings.json` file using `ConfigurationManager`. Hereβs a snippet of my code where I set up configuration: ```csharp using Microsoft.Extensions.Configuration; public class Program { public static void Main(string[] args) { var builder = new ConfigurationManager(); builder.SetBasePath(Directory.GetCurrentDirectory()); builder.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); var configuration = builder.Build(); var mySetting = configuration["MySetting"]; Console.WriteLine(mySetting); // This always prints null } } ``` My `appsettings.json` file looks like this: ```json { "MySetting": "TestValue" } ``` Iβve verified that the `appsettings.json` file is present in the output directory and has the correct build action set to `Content`. I've also tried to access the configuration in different places in the code, such as inside a controller after dependency injecting `IConfiguration`, but I still get `null`. Iβm using .NET 7 SDK version 7.0.100. I've even tried cleaning and rebuilding the solution, but the question continues. Is there something Iβm missing in the configuration setup, or could there be an scenario with how values are being read from the JSON file? I'm working on a API that needs to handle this. What's the best practice here? I'd really appreciate any guidance on this. What would be the recommended way to handle this? I'm working in a Ubuntu 22.04 environment. Could this be a known issue? Any help would be greatly appreciated! What am I doing wrong?