When I deploy my Dot Net Core web app to Azure, the Environment.ContentRootPath
variable is set to [myproject]/wwwroot
. However, in development, it is just [myproject]
.
Why does it change in Azure deployment?
How can I make it consistent?
For reference, this is my IWebHost
.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((builderContext, config) =>
{
var env = builderContext.HostingEnvironment;
config.AddJsonFile("appsettings.json", false, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
if (env.IsDevelopment())
config.AddUserSecrets<Startup>();
config.AddEnvironmentVariables();
})
.UseSetting("detailedErrors", "true")
.UseApplicationInsights()
.UseStartup<Startup>()
.CaptureStartupErrors(true)
.Build();