2 writes to HostingEnvironment
Microsoft.AspNetCore.Hosting (2)
GenericHost\WebHostBuilderBase.cs (1)
83HostingEnvironment = new HostingEnvironment(),
WebHostBuilder.cs (1)
263_context.HostingEnvironment = _hostingEnvironment;
31 references to HostingEnvironment
CreateDefaultBuilderApp (3)
Program.cs (3)
43if (!string.Equals(contentRoot, context.HostingEnvironment.ContentRootPath, StringComparison.Ordinal)) 45return $"ContentRootPath incorrect. Expected: {contentRoot} Actual: {context.HostingEnvironment.ContentRootPath}"; 57return $"appsettings.{context.HostingEnvironment.EnvironmentName}.json not loaded into Configuration.";
CreateDefaultBuilderOfTApp (3)
Program.cs (3)
55if (!string.Equals(contentRoot, context.HostingEnvironment.ContentRootPath, StringComparison.Ordinal)) 57return $"ContentRootPath incorrect. Expected: {contentRoot} Actual: {context.HostingEnvironment.ContentRootPath}"; 69return $"appsettings.{context.HostingEnvironment.EnvironmentName}.json not loaded into Configuration.";
HostFilteringSample (1)
Program.cs (1)
26var env = hostingContext.HostingEnvironment;
Kestrel.SampleApp (1)
Startup.cs (1)
80if (context.HostingEnvironment.IsDevelopment())
Microsoft.AspNetCore (11)
ConfigureWebHostBuilder.cs (5)
26_environment = webHostBuilderContext.HostingEnvironment; 39var previousContentRoot = HostingPathResolver.ResolvePath(_context.HostingEnvironment.ContentRootPath); 41var previousWebRoot = HostingPathResolver.ResolvePath(_context.HostingEnvironment.WebRootPath, previousContentRoot); 116var previousContentRoot = HostingPathResolver.ResolvePath(_context.HostingEnvironment.ContentRootPath); 117var previousWebRoot = HostingPathResolver.ResolvePath(_context.HostingEnvironment.WebRootPath);
WebApplicationBuilder.cs (2)
211Environment = webHostContext.HostingEnvironment; 400if (allowDeveloperExceptionPage && context.HostingEnvironment.IsDevelopment())
WebHost.cs (4)
170var env = hostingContext.HostingEnvironment; 209options.ValidateScopes = context.HostingEnvironment.IsDevelopment(); 221if (ctx.HostingEnvironment.IsDevelopment()) 223StaticWebAssetsLoader.UseStaticWebAssets(ctx.HostingEnvironment, ctx.Configuration);
Microsoft.AspNetCore.Hosting (8)
GenericHost\GenericWebHostBuilder.cs (4)
58services.AddSingleton(webhostContext.HostingEnvironment); 60services.AddSingleton((AspNetCore.Hosting.IHostingEnvironment)webhostContext.HostingEnvironment); 102var startupType = StartupLoader.FindStartupType(webHostOptions.StartupAssembly!, webhostContext.HostingEnvironment.EnvironmentName); 380return _context.HostingEnvironment;
GenericHost\SlimWebHostBuilder.cs (2)
34services.AddSingleton(webhostContext.HostingEnvironment); 36services.AddSingleton((AspNetCore.Hosting.IHostingEnvironment)webhostContext.HostingEnvironment);
GenericHost\WebHostBuilderBase.cs (1)
85webHostBuilderContext.HostingEnvironment.Initialize(context.HostingEnvironment.ContentRootPath, options, baseEnvironment: context.HostingEnvironment);
WebHostBuilderExtensions.cs (1)
256StaticWebAssetsLoader.UseStaticWebAssets(context.HostingEnvironment, context.Configuration);
Microsoft.AspNetCore.Hosting.Tests (1)
WebHostBuilderTests.cs (1)
254Assert.NotNull(context.HostingEnvironment);
Microsoft.AspNetCore.Tests (3)
WebApplicationTests.cs (3)
946Assert.Equal(assemblyName, context.HostingEnvironment.ApplicationName); 988Assert.Equal(assemblyName, context.HostingEnvironment.ApplicationName); 1051Assert.Equal("Testing", context.HostingEnvironment.EnvironmentName);