17 implementations of EnvironmentName
Aspire.Dashboard.Tests (1)
BrowserSecurityHeadersMiddlewareTests.cs (1)
93public string EnvironmentName { get; set; } = "Development";
Aspire.Hosting.Tests (1)
Dashboard\DashboardServiceTests.cs (1)
153public string EnvironmentName { get; set; } = default!;
Microsoft.AspNetCore.Components.Endpoints.Tests (5)
Builder\RazorComponentsEndpointConventionBuilderExtensionsTest.cs (1)
290public string EnvironmentName { get; set; } = "TestEnvironment";
HotReloadServiceTests.cs (1)
277public string EnvironmentName { get; set; } = "TestEnvironment";
RazorComponentEndpointDataSourceTest.cs (1)
293public string EnvironmentName { get; set; } = "TestEnvironment";
RazorComponentEndpointInvokerTest.cs (1)
58public string EnvironmentName { get => "Development"; set => throw new NotImplementedException(); }
RazorComponentsServiceCollectionExtensionsTest.cs (1)
143public string EnvironmentName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
Microsoft.AspNetCore.Grpc.Swagger.Tests (1)
Infrastructure\TestWebHostEnvironment.cs (1)
16public string EnvironmentName { get; set; }
Microsoft.AspNetCore.Hosting (1)
Internal\HostingEnvironment.cs (1)
14public string EnvironmentName { get; set; } = Extensions.Hosting.Environments.Production;
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
1609public string EnvironmentName { get; set; } = null!;
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Builder\PageActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (1)
262public string EnvironmentName { get; set; } = "TestEnvironment";
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
Builder\ControllerActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (1)
338public string EnvironmentName { get; set; } = "TestEnvironment";
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiGeneratorTests.cs (1)
1030public string EnvironmentName { get; set; }
Microsoft.AspNetCore.Routing.Tests (1)
RouteHandlerOptionsTests.cs (1)
74public string EnvironmentName { get; set; }
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
KestrelConfigurationLoaderTests.cs (1)
1877public string EnvironmentName { get; set; }
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaServicesExtensionsTests.cs (1)
103public string EnvironmentName { get; set; }
Microsoft.Extensions.Hosting (1)
Internal\HostingEnvironment.cs (1)
21public string EnvironmentName { get; set; } = string.Empty;
3 writes to EnvironmentName
Microsoft.AspNetCore.Hosting (1)
Internal\HostingEnvironmentExtensions.cs (1)
106hostingEnvironment.EnvironmentName =
Microsoft.AspNetCore.Hosting.Tests (2)
Fakes\StartupWithHostingEnvironment.cs (1)
13env.EnvironmentName = "Changed";
HostingEnvironmentExtensionsTests.cs (1)
62env.EnvironmentName = "SomeName";
111 references to EnvironmentName
Aspire.Hosting.Tests (3)
PublishAsDockerfileTests.cs (3)
31"NODE_ENV": "{{builder.Environment.EnvironmentName.ToLowerInvariant()}}" 73"NODE_ENV": "{{builder.Environment.EnvironmentName.ToLowerInvariant()}}" 107"NODE_ENV": "{{builder.Environment.EnvironmentName.ToLowerInvariant()}}"
blazor-devserver (1)
Server\Startup.cs (1)
40ctx.Response.Headers.Append("Blazor-Environment", webHostEnvironment.EnvironmentName);
CreateDefaultBuilderApp (1)
Program.cs (1)
57return $"appsettings.{context.HostingEnvironment.EnvironmentName}.json not loaded into Configuration.";
CreateDefaultBuilderOfTApp (1)
Program.cs (1)
69return $"appsettings.{context.HostingEnvironment.EnvironmentName}.json not loaded into Configuration.";
HostFilteringSample (1)
Program.cs (1)
28.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
IdentitySample.DefaultUI (1)
Startup.cs (1)
26.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
IdentitySample.Mvc (1)
Startup.cs (1)
19.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
Kestrel.SampleApp (1)
Startup.cs (1)
181.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
Microsoft.AspNetCore (9)
WebApplicationBuilder.cs (1)
274.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: reloadOnChange);
WebHost.cs (8)
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, 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, 173.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); 293/// load <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json', 294/// load <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly,
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
RazorComponentResultTest.cs (1)
454x => x.EnvironmentName == (environmentName ?? Environments.Production));
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
ComponentsWebAssemblyApplicationBuilderExtensions.cs (1)
48context.Response.Headers.Append("Blazor-Environment", webHostEnvironment.EnvironmentName);
ComponentWebAssemblyConventions.cs (1)
23new("Blazor-Environment", webHostEnvironment.EnvironmentName)
Microsoft.AspNetCore.Hosting (12)
GenericHost\GenericWebHostBuilder.cs (5)
102var startupType = StartupLoader.FindStartupType(webHostOptions.StartupAssembly!, webhostContext.HostingEnvironment.EnvironmentName); 230if (StartupLoader.HasConfigureServicesIServiceProviderDelegate(startupType, context.HostingEnvironment.EnvironmentName)) 239var configureServicesBuilder = StartupLoader.FindConfigureServicesDelegate(startupType, context.HostingEnvironment.EnvironmentName); 246var configureContainerBuilder = StartupLoader.FindConfigureContainerDelegate(startupType, context.HostingEnvironment.EnvironmentName); 256configureBuilder = StartupLoader.FindConfigureDelegate(startupType, context.HostingEnvironment.EnvironmentName);
Internal\HostingEnvironmentExtensions.cs (2)
107baseEnvironment?.EnvironmentName ?? 109hostingEnvironment.EnvironmentName;
Internal\WebHostOptions.cs (1)
24Environment = environment?.EnvironmentName ?? GetConfig(WebHostDefaults.EnvironmentKey);
WebHostBuilder.cs (1)
332var methods = StartupLoader.LoadMethods(serviceProvider, startupType, hostingEnvironment.EnvironmentName);
WebHostBuilderExtensions.cs (2)
122return new ConventionBasedStartup(StartupLoader.LoadMethods(serviceProvider, instance.GetType(), hostingEnvironment.EnvironmentName, instance)); 159return new ConventionBasedStartup(StartupLoader.LoadMethods(sp, startupType, hostingEnvironment.EnvironmentName));
WebHostExtensions.cs (1)
119Console.WriteLine($"Hosting environment: {hostingEnvironment?.EnvironmentName}");
Microsoft.AspNetCore.Hosting.Tests (7)
HostingEnvironmentExtensionsTests.cs (1)
73Assert.Equal("NewName", env.EnvironmentName);
WebHostBuilderTests.cs (2)
611Assert.Equal(expected, host.Services.GetService<IHostEnvironment>().EnvironmentName); 612Assert.Equal(expected, host.Services.GetService<IWebHostEnvironment>().EnvironmentName);
WebHostTests.cs (4)
718Assert.Equal("Changed", env.EnvironmentName); 805Assert.Equal(Environments.Production, env.EnvironmentName); 828Assert.Equal(Environments.Staging, env.EnvironmentName); 829Assert.Equal(Environments.Staging, env.EnvironmentName);
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (4)
CSharpCompilerTest.cs (4)
59hostingEnvironment.SetupGet(e => e.EnvironmentName) 77hostingEnvironment.SetupGet(e => e.EnvironmentName) 90var hostingEnvironment = Mock.Of<IWebHostEnvironment>(h => h.EnvironmentName == "Development"); 120var hostingEnvironment = Mock.Of<IWebHostEnvironment>(h => h.EnvironmentName == "Development");
Microsoft.AspNetCore.Mvc.TagHelpers (1)
EnvironmentTagHelper.cs (1)
81var currentEnvironmentName = HostingEnvironment.EnvironmentName?.Trim();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
EnvironmentTagHelperTest.cs (4)
90hostingEnvironment.SetupProperty(h => h.EnvironmentName, "Development"); 134hostingEnvironment.SetupProperty(h => h.EnvironmentName, "Development"); 169hostingEnvironment.SetupProperty(h => h.EnvironmentName, environmentName); 194hostingEnvironment.SetupProperty(h => h.EnvironmentName, environmentName);
Microsoft.AspNetCore.Tests (24)
WebApplicationTests.cs (24)
747Assert.Equal(Environments.Development, webApplication.Environment.EnvironmentName); 809Assert.Equal(envName, context.HostingEnvironment.EnvironmentName); 815Assert.Equal(envName, builder.Environment.EnvironmentName); 858Assert.Equal(envName, context.HostingEnvironment.EnvironmentName); 864Assert.Equal(envName, builder.Environment.EnvironmentName); 904Assert.Equal(envName, context.HostingEnvironment.EnvironmentName); 910Assert.Equal(envName, builder.Environment.EnvironmentName); 1047Assert.Equal("Testing", builder.Environment.EnvironmentName); 1051Assert.Equal("Testing", context.HostingEnvironment.EnvironmentName); 1056Assert.Equal("Testing", context.HostingEnvironment.EnvironmentName); 1063Assert.Equal("Testing", hostEnv.EnvironmentName); 1064Assert.Equal("Testing", webHostEnv.EnvironmentName); 1483Assert.Equal(env0.EnvironmentName, env1.EnvironmentName); 2259Assert.Equal(builder.Environment.EnvironmentName, hostEnv.EnvironmentName); 2263Assert.Equal(webHostEnv.EnvironmentName, hostEnv.EnvironmentName); 2267Assert.NotEqual(envName, hostEnv.EnvironmentName); 2289Assert.Equal(builder.Environment.EnvironmentName, hostEnv.EnvironmentName); 2293Assert.Equal(webHostEnv.EnvironmentName, hostEnv.EnvironmentName); 2297Assert.Equal(Environments.Staging, hostEnv.EnvironmentName);
Microsoft.Extensions.AmbientMetadata.Application (1)
ApplicationMetadataSource.cs (1)
46{ $"{SectionName}:{nameof(ApplicationMetadata.EnvironmentName)}", _hostEnvironment.EnvironmentName },
Microsoft.Extensions.AmbientMetadata.Application.Tests (3)
AcceptanceTests.cs (1)
36options.EnvironmentName.Should().Be(hostEnvironment.EnvironmentName);
ApplicationMetadataExtensionsTests.cs (1)
28_hostEnvironment.Setup(h => h.EnvironmentName).Returns(TestEnvironmentName);
ApplicationMetadataSourceTests.cs (1)
24_hostEnvironment.Setup(h => h.EnvironmentName).Returns(TestEnvironmentName);
Microsoft.Extensions.Hosting (26)
Host.cs (12)
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> 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> 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> 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 (6)
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 User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly</description></item> 49/// <item><description>enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development'</description></item> 66/// <item><description>load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json'</description></item> 67/// <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>
HostApplicationBuilderSettings.cs (3)
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'
HostingHostBuilderExtensions.cs (4)
184/// * load app <see cref="IConfiguration"/> from 'appsettings.json' and 'appsettings.[<see cref="IHostEnvironment.EnvironmentName"/>].json' 185/// * load app <see cref="IConfiguration"/> from User Secrets when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' using the entry assembly 189/// * enables scope validation on the dependency injection container when <see cref="IHostEnvironment.EnvironmentName"/> is 'Development' 242.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: reloadOnChange);
Internal\ConsoleLifetime.cs (1)
103Logger.LogInformation("Hosting environment: {EnvName}", Environment.EnvironmentName);
Microsoft.Extensions.Hosting.Abstractions (2)
HostDefaults.cs (1)
17/// The configuration key used to set <see cref="IHostEnvironment.EnvironmentName"/>.
HostEnvironmentEnvExtensions.cs (1)
62hostEnvironment.EnvironmentName,
Microsoft.Extensions.Hosting.Systemd (1)
SystemdLifetime.cs (1)
96Environment.EnvironmentName, Environment.ContentRootPath);
Microsoft.Extensions.Hosting.WindowsServices (1)
WindowsServiceLifetime.cs (1)
81Environment.EnvironmentName, Environment.ContentRootPath);
Microsoft.Extensions.Telemetry.Tests (2)
Enrichment\ApplicationLogEnricherTests.cs (2)
26_hostMock.SetupGet(c => c.EnvironmentName).Returns(EnvironmentName); 71EnvironmentName = _hostMock.Object.EnvironmentName
SimpleWebSiteWithWebApplicationBuilder (1)
Program.cs (1)
42app.MapGet("/environment", (IHostEnvironment environment) => environment.EnvironmentName);