Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

336
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda