1 interface inheriting from IHostEnvironment
Microsoft.AspNetCore.Hosting.Abstractions (1)
IWebHostEnvironment.cs (1)
12public interface IWebHostEnvironment : IHostEnvironment
10 implementations of IHostEnvironment
Aspire.Dashboard.Tests (1)
BrowserSecurityHeadersMiddlewareTests.cs (1)
88private sealed class TestHostEnvironment : IHostEnvironment
Aspire.Hosting.Azure.Tests (1)
ProvisioningTestHelpers.cs (1)
316internal sealed class TestHostEnvironment : IHostEnvironment
Aspire.Hosting.Tests (2)
Dashboard\DashboardServiceTests.cs (1)
460private sealed class TestHostEnvironment : IHostEnvironment
Dcp\DcpExecutorTests.cs (1)
1328private 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)
1824private 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)
1901private class MockHostingEnvironment : IHostEnvironment
Microsoft.Extensions.Hosting (1)
Internal\HostingEnvironment.cs (1)
15public class HostingEnvironment : IHostingEnvironment, IHostEnvironment
272 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 (6)
Dashboard\DashboardService.cs (1)
22internal sealed partial class DashboardService(DashboardServiceData serviceData, IHostEnvironment hostEnvironment, IHostApplicationLifetime hostApplicationLifetime, ILogger<DashboardService> logger)
Dcp\DcpExecutor.cs (1)
96IHostEnvironment hostEnvironment,
DistributedApplicationBuilder.cs (1)
64public IHostEnvironment Environment => _innerBuilder.Environment;
IDistributedApplicationBuilder.cs (1)
69public IHostEnvironment Environment { get; }
OtlpConfigurationExtensions.cs (1)
26public static void AddOtlpEnvironment(IResource resource, IConfiguration configuration, IHostEnvironment environment)
ResourceLoggerForwarderService.cs (1)
18IHostEnvironment hostEnvironment,
Aspire.Hosting.Azure (1)
Provisioning\Internal\DefaultProvisioningContextProvider.cs (1)
26IHostEnvironment environment,
Aspire.Hosting.Azure.Tests (12)
AzureDeployerTests.cs (1)
115var environment = ProvisioningTestHelpers.CreateEnvironment();
DefaultProvisioningContextProviderTests.cs (9)
23var environment = ProvisioningTestHelpers.CreateEnvironment(); 61var environment = ProvisioningTestHelpers.CreateEnvironment(); 89var environment = ProvisioningTestHelpers.CreateEnvironment(); 117var environment = ProvisioningTestHelpers.CreateEnvironment(); 153var environment = ProvisioningTestHelpers.CreateEnvironment(); 183var environment = ProvisioningTestHelpers.CreateEnvironment(); 214var environment = ProvisioningTestHelpers.CreateEnvironment(); 246var environment = ProvisioningTestHelpers.CreateEnvironment(); 320var environment = ProvisioningTestHelpers.CreateEnvironment();
ProvisioningTestHelpers.cs (2)
82public static IHostEnvironment CreateEnvironment() 314/// Test implementation of <see cref="IHostEnvironment"/>.
Aspire.Hosting.Testing (3)
DistributedApplicationTestingBuilder.cs (3)
231public IHostEnvironment Environment => innerBuilder.Environment; 381public IHostEnvironment Environment => _innerBuilder.Environment; 464new IHostEnvironment Environment => ((IDistributedApplicationBuilder)this).Environment;
Aspire.Hosting.Testing.Tests (4)
TestingBuilderTests.cs (2)
398var hostEnvironment = app.Services.GetRequiredService<IHostEnvironment>();
TestingFactoryTests.cs (2)
65var appModel = _app.Services.GetRequiredService<IHostEnvironment>();
Aspire.Hosting.Tests (1)
Dcp\DcpExecutorTests.cs (1)
1285IHostEnvironment? 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)
114var environment = app.Services.GetRequiredService<IHostEnvironment>(); 132var 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)
44var 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)
15var applicationName = webHost.Services.GetRequiredService<IHostEnvironment>().ApplicationName;
Kestrel.SampleApp (1)
Startup.cs (1)
179var env = hostingContext.HostingEnvironment;
Microsoft.AspNetCore (12)
WebApplicationBuilder.cs (2)
267private static void ApplyDefaultAppConfigurationSlim(IHostEnvironment env, ConfigurationManager configuration, string[]? args) 370IHostEnvironment IHostApplicationBuilder.Environment => Environment;
WebHost.cs (10)
123/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 124/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 125/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 142/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 143/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 144/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 148/// configure the <see cref="IWebHostEnvironment.WebRootFileProvider"/> to map static web assets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly, 294/// set the <see cref="IHostEnvironment.ContentRootPath"/> to the result of <see cref="Directory.GetCurrentDirectory()"/>, 295/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 296/// 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)
245var hostingEnv = _applicationServices.GetRequiredService<IHostEnvironment>();
Internal\WebHostOptions.cs (1)
14public WebHostOptions(IConfiguration primaryConfiguration, IConfiguration? fallbackConfiguration = null, IHostEnvironment? environment = null)
WebHostBuilder.cs (3)
269services.AddSingleton<IHostEnvironment>(_hostingEnvironment); 332var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>();
WebHostBuilderExtensions.cs (4)
114var hostingEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>(); 158var hostingEnvironment = sp.GetRequiredService<IHostEnvironment>();
WebHostExtensions.cs (2)
112var hostingEnvironment = host.Services.GetService<IHostEnvironment>();
Microsoft.AspNetCore.Hosting.Tests (27)
Fakes\StartupWithHostingEnvironment.cs (1)
11public StartupWithHostingEnvironment(IHostEnvironment env)
WebHostBuilderTests.cs (18)
613Assert.Equal(expected, host.Services.GetService<IHostEnvironment>().EnvironmentName); 661Assert.Equal("/", host.Services.GetService<IHostEnvironment>().ContentRootPath); 680var basePath = host.Services.GetRequiredService<IHostEnvironment>().ContentRootPath; 703Assert.Equal(appBase, host.Services.GetService<IHostEnvironment>().ContentRootPath); 734var hostingEnv = host.Services.GetService<IHostEnvironment>(); 752var hostingEnv = host.Services.GetService<IHostEnvironment>(); 770var hostingEnv = host.Services.GetService<IHostEnvironment>(); 783var hostingEnv = host.Services.GetService<IHostEnvironment>(); 799var hostingEnv = host.Services.GetService<IHostEnvironment>(); 815var hostingEnv = host.Services.GetService<IHostEnvironment>(); 829var hostingEnv = host.Services.GetService<IHostEnvironment>();
WebHostTests.cs (8)
714var env = host.Services.GetService<IHostEnvironment>(); 801var env = host.Services.GetService<IHostEnvironment>(); 824var env = host.Services.GetService<IHostEnvironment>(); 865var 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)
107var 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)
15public CertificateConfigLoader(IHostEnvironment hostEnvironment, ILogger<KestrelServer> logger) 21public 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)
950var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 992var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 1060var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 1478var env0 = app.Services.GetRequiredService<IHostEnvironment>(); 1480var env1 = app.Services.GetRequiredService<IServiceCollection>().BuildServiceProvider().GetRequiredService<IHostEnvironment>(); 2255var hostEnv = app.Services.GetRequiredService<IHostEnvironment>(); 2285var 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 (4)
AcceptanceTests.cs (2)
42private static async Task RunAsync(Func<ApplicationMetadata, IHostEnvironment, Task> func, string? sectionName) 60host.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)
23var env = context.RequestServices.GetRequiredService<IHostEnvironment>();
StartRouteBuilderUrlApp (2)
Program.cs (2)
24var env = req.HttpContext.RequestServices.GetRequiredService<IHostEnvironment>();
StartWithIApplicationBuilderUrlApp (2)
Program.cs (2)
26var env = context.RequestServices.GetRequiredService<IHostEnvironment>();