aspnet / MetaPackages

[Archived] NuGet meta packages. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
211 stars 109 forks source link

CreateDefaultBuilder overrides ASPNETCORE_CONTENTROOT #267

Closed Tratcher closed 6 years ago

Tratcher commented 6 years ago

Previously reported at https://github.com/aspnet/Hosting/issues/1335.

CreateDefaultBuilder always calls .UseContentRoot(Directory.GetCurrentDirectory()), which means it overwrites ASPNETCORE_CONTENTROOT that was read in the WebHostBuilder constructor.

Some recent changes in the functional test infrastructure have started relying on ASPNETCORE_CONTENTROOT (https://github.com/aspnet/Hosting/pull/1429) and now WebHost functional tests are broken. (http://aspnetci/viewLog.html?buildId=474296&tab=buildResultsDiv&buildTypeId=Lite_UniverseTest)

Proposal: Only call UseContentRoot if a value has not already been provided.