The Core 1.x configuration has been answered here
ASP.NET Core configuration for .NET Core console application
Unfortunately the Core 2.0.0 API and architecture has changed slightly and by the looks of this article that it uses Dependency Injection on the Startup class now (on a WebAPI based project) which is allot simpler.
But I am not sure how to do that on a Console application as there is no underlying DI. When I try to use the following code none of the methods exist on the new 2.0.0
var builder = new ConfigurationBuilder()
.AddJsonFile($"appsettings.json", true, true) -ERROR
.AddJsonFile($"appsettings.{environmentName}.json", true, true) -ERROR
.AddEnvironmentVariables(); -ERROR
Does any body know how to add appsettings.json
into the ConfigurationBuilder?