-
Notifications
You must be signed in to change notification settings - Fork 312
TestServer w/ WebHostBuilder doesn't read appsettings.json on ASP.NET Core 2.0, but it worked on 1.1 #1191
Comments
@neooleg WebHostBuilder and TestServer do not read appsettings.json in any scenarios. CreateDefaultBuilder is the only component that includes appsettins.json by default: |
@Tratcher I see, thanks! What is idiomatic way to read appsettings.json in tests? Except doing it explicit (which is might be good depending on case):
|
It needs to be explicit in all apps and tests unless you call CreateDefaultBuilder. |
Note there is a ConfigureAppConfgiuration method that is a little easier than UseConfiguration. |
Do you recommend to use CreateDefaultBuilder() in tests as well? |
It depends on what you're testing. If you're trying to mimic a full application then it may make sense. |
Thanks a lot, @Tratcher! P.S. The issue might be closed from my point of view. |
From @neooleg on August 30, 2017 19:59
STR
h3. AR
h3. ER
appsettings.json should be read and passed into Startup.
Copied from original issue: aspnet/KestrelHttpServer#2042
The text was updated successfully, but these errors were encountered: