Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
Difference between environment include vs environment names attributes

What's the difference between

<environment include="...">...

and

<environment names="...">...

The official documentation doesn't help distinguish them at all (to me):

Environment Tag Helper in ASP.NET Core

names

... If any of the provided environment names match the current environment, the enclosed content is rendered ... Environment values are compared to the current value returned by IWebHostEnvironment.EnvironmentName

The content is rendered if the hosting environment is Staging or Production

<environment names="Staging,Production">
    <strong>IWebHostEnvironment.EnvironmentName is Staging or Production</strong>
</environment>

include

The include property exhibits similar behavior to the names attribute. An environment listed in the include attribute value must match the app's hosting environment (IWebHostEnvironment.EnvironmentName) to render the content of the tag.

<environment include="Staging,Production">
    <strong>IWebHostEnvironment.EnvironmentName is Staging or Production</strong>
</environment>

Even their code snippets use the identical self-description "IWebHostEnvironment.EnvironmentName is Staging or Production".

What's the difference between the two?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It seems that "names" is the older way, and "include/exclude" is the newer way.

A new exclude attribute on the EnvironmentTagHelper lets you easily tell the EnvironmentTagHelper to render in all Environments EXCEPT the one(s) you specify. There’s also a new include attribute that behaves the same as names did in ASP.NET Core 1.

Exploring the Environment Tag Helper exclude and include attributes in ASP.NET Core 2

I guess that Microsoft kept the old names around for backwards compatibility. IDK why the documentation doesn't reflect that.

Based on my experience, the official documentation, and that article above, there isn't any functional difference between name and include. The name include just pairs better with exclude.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda