This is an old question but it pops up on Google as a top result so I'll share another answer. It has gotten simpler in newer versions of .NET. With the new hosting templates in .NET 6 you can simply use:
builder.Configuration.AddJsonFile("your/path/to/appsettings.json", false);