Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

335
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!