1 interface inheriting from IHostEnvironment
Microsoft.AspNetCore.Hosting.Abstractions (1)
IWebHostEnvironment.cs (1)
12public interface IWebHostEnvironment : IHostEnvironment
12 implementations of IHostEnvironment
Aspire.Dashboard.Tests (1)
BrowserSecurityHeadersMiddlewareTests.cs (1)
91private sealed class TestHostEnvironment : IHostEnvironment
Aspire.Hosting.Azure.Tests (1)
ProvisioningTestHelpers.cs (1)
587internal sealed class TestHostEnvironment : IHostEnvironment
Aspire.Hosting.Docker.Tests (1)
DockerComposePublisherTests.cs (1)
719private sealed class TestHostEnvironment(string environmentName) : Microsoft.Extensions.Hosting.IHostEnvironment
Aspire.Hosting.Tests (3)
Dashboard\DashboardServiceTests.cs (1)
607private sealed class TestHostEnvironment : IHostEnvironment
Dcp\DcpExecutorTests.cs (1)
2075private sealed class TestHostEnvironment : IHostEnvironment
Publishing\DeploymentStateManagerTests.cs (1)
241private sealed class TestHostEnvironment : IHostEnvironment
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
EndpointHtmlRendererTest.cs (1)
1950private class TestEnvironment(string environmentName) : IHostEnvironment
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
1850private class HostEnvironment : IHostEnvironment
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiGeneratorTests.cs (1)
1059internal class HostEnvironment : IHostEnvironment
Microsoft.AspNetCore.Routing.Tests (1)
RouteHandlerOptionsTests.cs (1)
69private class HostEnvironment : IHostEnvironment
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
KestrelConfigurationLoaderTests.cs (1)
2149private class MockHostingEnvironment : IHostEnvironment
Microsoft.Extensions.Hosting (1)
Internal\HostingEnvironment.cs (1)
15public class HostingEnvironment : IHostingEnvironment, IHostEnvironment
289 references to IHostEnvironment
Aspire.Dashboard (2)
Model\BrowserSecurityHeadersMiddleware.cs (2)
20public BrowserSecurityHeadersMiddleware(RequestDelegate next, IHostEnvironment environment) 28private static string GenerateCspContent(IHostEnvironment environment, bool isHttps)
Aspire.Hosting (11)
Dashboard\DashboardService.cs (1)
23internal sealed partial class DashboardService(DashboardServiceData serviceData, IHostEnvironment hostEnvironment, IHostApplicationLifetime hostApplicationLifetime, IConfiguration configuration, ILogger<DashboardService> logger)
Dcp\DcpExecutor.cs (1)
98IHostEnvironment hostEnvironment,
DistributedApplicationBuilder.cs (1)
70public IHostEnvironment Environment => _innerBuilder.Environment;
IDistributedApplicationBuilder.cs (1)
73public IHostEnvironment Environment { get; }
OtlpConfigurationExtensions.cs (3)
26public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment) 45public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment, OtlpProtocol protocol) 57private static void RegisterOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment)
Pipelines\DistributedApplicationPipeline.cs (2)
49var hostEnvironment = context.Services.GetRequiredService<IHostEnvironment>();
Pipelines\Internal\FileDeploymentStateManager.cs (1)
21IHostEnvironment hostEnvironment,
ResourceLoggerForwarderService.cs (1)
18IHostEnvironment hostEnvironment,
Aspire.Hosting.Azure (4)
Provisioning\Internal\BaseProvisioningContextProvider.cs (2)
24IHostEnvironment environment, 39protected readonly IHostEnvironment _environment = environment;
Provisioning\Internal\PublishModeProvisioningContextProvider.cs (1)
24IHostEnvironment environment,
Provisioning\Internal\RunModeProvisioningContextProvider.cs (1)
23IHostEnvironment environment,
Aspire.Hosting.Azure.Tests (15)
AzureDeployerTests.cs (2)
1077var environment = ProvisioningTestHelpers.CreateEnvironment(); 1332builder.Services.AddSingleton<IHostEnvironment>(environment);
ProvisioningContextProviderTests.cs (11)
25var environment = ProvisioningTestHelpers.CreateEnvironment(); 63var environment = ProvisioningTestHelpers.CreateEnvironment(); 92var environment = ProvisioningTestHelpers.CreateEnvironment(); 121var environment = ProvisioningTestHelpers.CreateEnvironment(); 153var environment = ProvisioningTestHelpers.CreateEnvironment(); 184var environment = ProvisioningTestHelpers.CreateEnvironment(); 216var environment = ProvisioningTestHelpers.CreateEnvironment(); 249var environment = ProvisioningTestHelpers.CreateEnvironment(); 355var environment = ProvisioningTestHelpers.CreateEnvironment(); 417var environment = ProvisioningTestHelpers.CreateEnvironment(); 526var environment = ProvisioningTestHelpers.CreateEnvironment();
ProvisioningTestHelpers.cs (2)
101public static IHostEnvironment CreateEnvironment() 585/// Test implementation of <see cref="IHostEnvironment"/>.
Aspire.Hosting.Docker (2)
DockerComposeEnvironmentResource.cs (2)
366var hostEnvironment = context.Services.GetService<Microsoft.Extensions.Hosting.IHostEnvironment>();
Aspire.Hosting.Docker.Tests (2)
DockerComposePublisherTests.cs (2)
537builder.Services.AddSingleton<Microsoft.Extensions.Hosting.IHostEnvironment>(new TestHostEnvironment("Staging")); 631builder.Services.AddSingleton<Microsoft.Extensions.Hosting.IHostEnvironment>(new TestHostEnvironment("Staging"));
Aspire.Hosting.Testing (3)
DistributedApplicationTestingBuilder.cs (3)
235public IHostEnvironment Environment => innerBuilder.Environment; 387public IHostEnvironment Environment => _innerBuilder.Environment; 472new IHostEnvironment Environment => ((IDistributedApplicationBuilder)this).Environment;
Aspire.Hosting.Testing.Tests (4)
TestingBuilderTests.cs (2)
401var hostEnvironment = app.Services.GetRequiredService<IHostEnvironment>();
TestingFactoryTests.cs (2)
65var appModel = _app.Services.GetRequiredService<IHostEnvironment>();
Aspire.Hosting.Tests (1)
Dcp\DcpExecutorTests.cs (1)
2005IHostEnvironment? hostEnvironment = null,
Aspire.Keycloak.Authentication (2)
AspireKeycloakExtensions.cs (2)
90.Configure<IConfiguration, IHttpClientFactory, IHostEnvironment>((options, configuration, httpClientFactory, hostEnvironment) => 172.Configure<IConfiguration, IHttpClientFactory, IHostEnvironment>((options, configuration, httpClientFactory, hostEnvironment) =>
Aspire.Playground.Tests (4)
Infrastructure\DistributedApplicationExtensions.cs (4)
115var environment = app.Services.GetRequiredService<IHostEnvironment>(); 133var environment = app.Services.GetRequiredService<IHostEnvironment>();
CatalogService (1)
CatalogApi.cs (1)
31group.MapGet("items/{catalogItemId:int}/image", async (int catalogItemId, CatalogDbContext catalogDbContext, IHostEnvironment environment) =>
CreateDefaultBuilderOfTApp (2)
Program.cs (2)
46var hostingEnvironment = app.ApplicationServices.GetRequiredService<IHostEnvironment>();
InMemory.FunctionalTests (2)
HttpsConnectionMiddlewareTests.cs (1)
36var env = new Mock<IHostEnvironment>();
HttpsTests.cs (1)
41.AddSingleton(Mock.Of<IHostEnvironment>())
IStartupInjectionAssemblyName (1)
Program.cs (1)
17var applicationName = webHost.Services.GetRequiredService<IHostEnvironment>().ApplicationName;
Kestrel.SampleApp (1)
Startup.cs (1)
179var env = hostingContext.HostingEnvironment;
Microsoft.AspNetCore (12)
WebApplicationBuilder.cs (2)
269private static void ApplyDefaultAppConfigurationSlim(IHostEnvironment env, ConfigurationManager configuration, string[]? args) 372IHostEnvironment IHostApplicationBuilder.Environment => Environment;
WebHost.cs (10)
125/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 126/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 127/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 144/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 145/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 146/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 150/// configure the <see cref="IWebHostEnvironment.WebRootFileProvider"/> to map static web assets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 296/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 297/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 298/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly,
Microsoft.AspNetCore.Components.Endpoints (2)
DependencyInjection\WebAssemblySettingsEmitter.cs (1)
11internal class WebAssemblySettingsEmitter(IHostEnvironment hostEnvironment)
Rendering\EndpointHtmlRenderer.EventDispatch.cs (1)
77return _httpContext.RequestServices.GetService<IHostEnvironment>()?.IsDevelopment() == true
Microsoft.AspNetCore.Components.Endpoints.Tests (3)
EndpointHtmlRendererTest.cs (3)
1031.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development)) 1060.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development)) 1153.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development))
Microsoft.AspNetCore.DataProtection (2)
Internal\HostingApplicationDiscriminator.cs (2)
13private readonly IHostEnvironment? _hosting; 22public HostingApplicationDiscriminator(IHostEnvironment hosting)
Microsoft.AspNetCore.DataProtection.Tests (3)
DataProtectionUtilityExtensionsTests.cs (3)
30var mockEnvironment = new Mock<IHostEnvironment>(); 61var mockEnvironment = new Mock<IHostEnvironment>(); 88var mockEnvironment = new Mock<IHostEnvironment>();
Microsoft.AspNetCore.Hosting (14)
GenericHost\GenericWebHostBuilder.cs (1)
385|| serviceType == typeof(IHostEnvironment)
Internal\HostingEnvironmentExtensions.cs (1)
64IHostEnvironment? baseEnvironment = null)
Internal\WebHost.cs (2)
246var hostingEnv = _applicationServices.GetRequiredService<IHostEnvironment>();
Internal\WebHostOptions.cs (1)
14public WebHostOptions(IConfiguration primaryConfiguration, IConfiguration? fallbackConfiguration = null, IHostEnvironment? environment = null)
WebHostBuilder.cs (3)
270services.AddSingleton<IHostEnvironment>(_hostingEnvironment); 333var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>();
WebHostBuilderExtensions.cs (4)
114var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>(); 158var hostingEnvironment = sp.GetRequiredService<IHostEnvironment>();
WebHostExtensions.cs (2)
114var hostingEnvironment = host.Services.GetService<IHostEnvironment>();
Microsoft.AspNetCore.Hosting.Tests (27)
Fakes\StartupWithHostingEnvironment.cs (1)
11public StartupWithHostingEnvironment(IHostEnvironment env)
WebHostBuilderTests.cs (18)
615Assert.Equal(expected, host.Services.GetService<IHostEnvironment>().EnvironmentName); 663Assert.Equal("/", host.Services.GetService<IHostEnvironment>().ContentRootPath); 682var basePath = host.Services.GetRequiredService<IHostEnvironment>().ContentRootPath; 705Assert.Equal(appBase, host.Services.GetService<IHostEnvironment>().ContentRootPath); 736var hostingEnv = host.Services.GetService<IHostEnvironment>(); 754var hostingEnv = host.Services.GetService<IHostEnvironment>(); 772var hostingEnv = host.Services.GetService<IHostEnvironment>(); 785var hostingEnv = host.Services.GetService<IHostEnvironment>(); 801var hostingEnv = host.Services.GetService<IHostEnvironment>(); 817var hostingEnv = host.Services.GetService<IHostEnvironment>(); 831var hostingEnv = host.Services.GetService<IHostEnvironment>();
WebHostTests.cs (8)
716var env = host.Services.GetService<IHostEnvironment>(); 803var env = host.Services.GetService<IHostEnvironment>(); 826var env = host.Services.GetService<IHostEnvironment>(); 867var env = host.Services.GetRequiredService<IHostEnvironment>();
Microsoft.AspNetCore.HttpLogging (2)
FileLoggerProcessor.cs (1)
40public FileLoggerProcessor(IOptionsMonitor<W3CLoggerOptions> options, IHostEnvironment environment, ILoggerFactory factory)
W3CLoggerProcessor.cs (1)
19public W3CLoggerProcessor(IOptionsMonitor<W3CLoggerOptions> options, IHostEnvironment environment, ILoggerFactory factory) : base(options, environment, factory)
Microsoft.AspNetCore.HttpLogging.Tests (1)
TestW3CLoggerProcessor.cs (1)
18public TestW3CLoggerProcessor(IOptionsMonitor<W3CLoggerOptions> options, IHostEnvironment environment, ILoggerFactory factory) : base(options, environment, factory)
Microsoft.AspNetCore.Mvc.ApiExplorer (2)
EndpointMetadataApiDescriptionProvider.cs (2)
25private readonly IHostEnvironment _environment; 34IHostEnvironment environment,
Microsoft.AspNetCore.Mvc.Test (1)
MvcServiceCollectionExtensionsTest.cs (1)
400services.AddSingleton<IHostEnvironment>(hostEnvironment);
Microsoft.AspNetCore.OpenApi (6)
Extensions\OpenApiEndpointConventionBuilderExtensions.cs (2)
108var hostEnvironment = applicationServices.GetService<IHostEnvironment>();
Services\OpenApiDocumentService.cs (1)
36IHostEnvironment hostEnvironment,
Services\OpenApiGenerator.cs (3)
32private readonly IHostEnvironment? _environment; 36/// Creates an <see cref="OpenApiGenerator" /> instance given an <see cref="IHostEnvironment" /> 42IHostEnvironment? environment,
Microsoft.AspNetCore.OpenApi.Tests (13)
Extensions\OpenApiEndpointRouteBuilderExtensionsTests.cs (1)
249.AddSingleton<IHostEnvironment>(hostEnvironment)
Extensions\OpenApiRouteHandlerBuilderExtensionTests.cs (7)
24.AddSingleton<IHostEnvironment>(hostEnvironment) 47.AddSingleton<IHostEnvironment>(hostEnvironment) 70.AddSingleton<IHostEnvironment>(hostEnvironment) 98.AddSingleton<IHostEnvironment>(hostEnvironment) 127.AddSingleton<IHostEnvironment>(hostEnvironment) 159.AddSingleton<IHostEnvironment>(hostEnvironment) 189.AddSingleton<IHostEnvironment>(hostEnvironment)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (4)
201services.AddSingleton<IHostEnvironment>(new HostingEnvironment 225services.AddSingleton<IHostEnvironment>(new HostingEnvironment 250services.AddSingleton<IHostEnvironment>(new HostingEnvironment 281services.AddSingleton<IHostEnvironment>(new HostingEnvironment
Services\OpenApiDocumentProviderTests.cs (1)
116.AddSingleton<IHostEnvironment>(hostEnvironment)
Microsoft.AspNetCore.Routing (3)
ConfigureRouteHandlerOptions.cs (2)
11private readonly IHostEnvironment? _environment; 13public ConfigureRouteHandlerOptions(IHostEnvironment? environment = null)
RouteHandlerOptions.cs (1)
22/// Defaults to <see cref="HostEnvironmentEnvExtensions.IsDevelopment(IHostEnvironment)"/>.
Microsoft.AspNetCore.Routing.Tests (3)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (1)
365services.AddSingleton(Mock.Of<IHostEnvironment>());
RouteHandlerOptionsTests.cs (2)
23services.AddSingleton<IHostEnvironment>(new HostEnvironment 43services.AddSingleton<IHostEnvironment>(new HostEnvironment
Microsoft.AspNetCore.Server.Kestrel.Core (18)
HttpsConfigurationService.cs (3)
58IHostEnvironment hostEnvironment, 243private readonly IHostEnvironment _hostEnvironment; 248IHostEnvironment hostEnvironment,
IHttpsConfigurationService.cs (1)
32IHostEnvironment hostEnvironment,
Internal\CertificatePathWatcher.cs (1)
30public CertificatePathWatcher(IHostEnvironment hostEnvironment, ILogger<CertificatePathWatcher> logger)
Internal\Certificates\CertificateConfigLoader.cs (2)
16public CertificateConfigLoader(IHostEnvironment hostEnvironment, ILogger<KestrelServer> logger) 22public IHostEnvironment HostEnvironment { get; }
KestrelServer.cs (1)
84public void Initialize(IHostEnvironment hostEnvironment, ILogger<KestrelServer> serverLogger, ILogger<HttpsConnectionMiddleware> httpsLogger)
KestrelServerOptions.cs (3)
330var hostEnvironment = ApplicationServices.GetRequiredService<IHostEnvironment>(); 465ApplicationServices.GetRequiredService<IHostEnvironment>(),
ListenOptionsHttpsExtensions.cs (6)
38var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>(); 52var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>(); 67var env = listenOptions.ApplicationServices.GetRequiredService<IHostEnvironment>();
TlsConfigurationLoader.cs (1)
30IHostEnvironment hostEnvironment,
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (5)
KestrelServerOptionsTests.cs (1)
84serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>());
KestrelServerTests.cs (4)
39.AddSingleton(Mock.Of<IHostEnvironment>()) 301serviceProvider.GetRequiredService<IHostEnvironment>(), 791serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>()); 930serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>());
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
KestrelConfigurationLoaderTests.cs (1)
29.AddSingleton<IHostEnvironment>(env)
Microsoft.AspNetCore.StaticAssets (1)
StaticAssetsEndpointRouteBuilderExtensions.cs (1)
23/// The <paramref name="staticAssetsManifestPath"/> can be <see langword="null"/> to use the <see cref="IHostEnvironment.ApplicationName"/> to locate the manifest.
Microsoft.AspNetCore.Tests (14)
WebApplicationTests.cs (14)
952var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 994var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 1062var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 1480var env0 = app.Services.GetRequiredService<IHostEnvironment>(); 1482var env1 = app.Services.GetRequiredService<IServiceCollection>().BuildServiceProvider().GetRequiredService<IHostEnvironment>(); 2257var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 2287var hostEnv = app.Services.GetRequiredService<IHostEnvironment>();
Microsoft.Extensions.AmbientMetadata.Application (5)
ApplicationMetadataConfigurationBuilderExtensions.cs (2)
22/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment" />.</param> 27public static IConfigurationBuilder AddApplicationMetadata(this IConfigurationBuilder builder, IHostEnvironment hostEnvironment, string sectionName = DefaultSectionName)
ApplicationMetadataSource.cs (3)
17private readonly IHostEnvironment _hostEnvironment; 22/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> 26public ApplicationMetadataSource(IHostEnvironment hostEnvironment, string sectionName)
Microsoft.Extensions.AmbientMetadata.Application.Tests (6)
AcceptanceTests.cs (4)
58private static async Task RunAsync(Func<ApplicationMetadata, IHostEnvironment, Task> func, string? sectionName) 76host.Services.GetRequiredService<IHostEnvironment>()); 80private static async Task RunAsync_HostBuilder(Func<ApplicationMetadata, IHostEnvironment, Task> func, string? sectionName) 103host.Services.GetRequiredService<IHostEnvironment>());
ApplicationMetadataExtensionsTests.cs (1)
24private readonly Mock<IHostEnvironment> _hostEnvironment = new();
ApplicationMetadataSourceTests.cs (1)
19private readonly Mock<IHostEnvironment> _hostEnvironment = new();
Microsoft.Extensions.Hosting (56)
Host.cs (16)
21/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 23/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 24/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 27/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 40/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 43/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 44/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 48/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 65/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 67/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 68/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 71/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 83/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 86/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 87/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 91/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item>
HostApplicationBuilder.cs (19)
24private readonly IHostEnvironment _environment; 41/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 44/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 45/// <item><description>load app <see cref="IConfiguration"/> from '[<see cref="IHostEnvironment.ApplicationName"/>].settings.json' and '[<see cref="IHostEnvironment.ApplicationName"/>].settings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' when <see cref="IHostEnvironment.ApplicationName"/> is not empty</description></item> 46/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 50/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 64/// <item><description>set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/></description></item> 67/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 68/// <item><description>load app <see cref="IConfiguration"/> from '[<see cref="IHostEnvironment.ApplicationName"/>].settings.json' and '[<see cref="IHostEnvironment.ApplicationName"/>].settings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' when <see cref="IHostEnvironment.ApplicationName"/> is not empty</description></item> 69/// <item><description>load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 73/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 138private void Initialize(HostApplicationBuilderSettings settings, out HostBuilderContext hostBuilderContext, out IHostEnvironment environment, out LoggingBuilder logging, out MetricsBuilder metrics) 193public IHostEnvironment Environment => _environment;
HostApplicationBuilderSettings.cs (4)
31/// * set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/> 33/// * load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' 34/// * load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly 38/// * enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'
HostBuilder.cs (2)
57/// Set up the configuration for the builder itself. This will be used to initialize the <see cref="IHostEnvironment"/> 303services.AddSingleton<IHostEnvironment>(hostingEnvironment);
HostingHostBuilderExtensions.cs (9)
181/// * set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/> 184/// * load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' 185/// * load app <see cref="IConfiguration"/> from '[<see cref="IHostEnvironment.ApplicationName"/>].settings.json' and '[<see cref="IHostEnvironment.ApplicationName"/>].settings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' when <see cref="IHostEnvironment.ApplicationName"/> is not empty 186/// * load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly 190/// * enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' 239IHostEnvironment env = hostingContext.HostingEnvironment;
Internal\ConsoleLifetime.cs (3)
34public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions) 46public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions, ILoggerFactory loggerFactory) 63private IHostEnvironment Environment { get; }
Internal\Host.cs (3)
27private readonly IHostEnvironment _hostEnvironment; 35IHostEnvironment hostEnvironment, 454public IHostEnvironment Environment => host._hostEnvironment;
Microsoft.Extensions.Hosting.Abstractions (17)
HostBuilderContext.cs (2)
27/// The <see cref="IHostEnvironment" /> initialized by the <see cref="IHost" />. 29public IHostEnvironment HostingEnvironment { get; set; } = null!;
HostDefaults.cs (4)
12/// The configuration key used to set <see cref="IHostEnvironment.ApplicationName"/>. 17/// The configuration key used to set <see cref="IHostEnvironment.EnvironmentName"/>. 22/// The configuration key used to set <see cref="IHostEnvironment.ContentRootPath"/> 23/// and <see cref="IHostEnvironment.ContentRootFileProvider"/>.
HostEnvironmentEnvExtensions.cs (9)
9/// Extension methods for <see cref="IHostEnvironment"/>. 16/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> 18public static bool IsDevelopment(this IHostEnvironment hostEnvironment) 28/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> 30public static bool IsStaging(this IHostEnvironment hostEnvironment) 40/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> 42public static bool IsProduction(this IHostEnvironment hostEnvironment) 52/// <param name="hostEnvironment">An instance of <see cref="IHostEnvironment"/>.</param> 56this IHostEnvironment hostEnvironment,
IHostApplicationBuilder.cs (1)
34IHostEnvironment Environment { get; }
IHostBuilder.cs (1)
22/// Sets up the configuration for the builder itself. This will be used to initialize the <see cref="IHostEnvironment"/>
Microsoft.Extensions.Hosting.Systemd (2)
SystemdLifetime.cs (2)
32public SystemdLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ISystemdNotifier systemdNotifier, ILoggerFactory loggerFactory) 46private IHostEnvironment Environment { get; }
Microsoft.Extensions.Hosting.WindowsServices (4)
WindowsServiceLifetime.cs (3)
33public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions<HostOptions> optionsAccessor) 46public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions<HostOptions> optionsAccessor, IOptions<WindowsServiceLifetimeOptions> windowsServiceOptionsAccessor) 63private IHostEnvironment Environment { get; }
WindowsServiceLifetimeHostBuilderExtensions.cs (1)
129public EventLogSettingsSetup(IHostEnvironment environment)
Microsoft.Extensions.Telemetry.Tests (2)
Enrichment\ApplicationLogEnricherTests.cs (2)
21private readonly Mock<IHostEnvironment> _hostMock; 25_hostMock = new Mock<IHostEnvironment>(MockBehavior.Strict);
SimpleWebSiteWithWebApplicationBuilder (1)
Program.cs (1)
42app.MapGet("/environment", (IHostEnvironment environment) => environment.EnvironmentName);
StartRequestDelegateUrlApp (2)
Program.cs (2)
25var env = context.RequestServices.GetRequiredService<IHostEnvironment>();
StartRouteBuilderUrlApp (2)
Program.cs (2)
26var env = req.HttpContext.RequestServices.GetRequiredService<IHostEnvironment>();
StartWithIApplicationBuilderUrlApp (2)
Program.cs (2)
28var env = context.RequestServices.GetRequiredService<IHostEnvironment>();