How to conditionally add to the Master head based on environment eg Dev Test etc.
I've got a requirement to add script to the head of the Master.cshtml file, but not if the environment is development, so I'm wondering how to do this.
I suspect there must be something built in to do this, I've looked I just can't find it.
In startup.cs, I see IWebHostEnvironment offers an EnvironmentName property, but that's in the apps bootstraping code.
How to conditionally add to the Master head based on environment eg Dev Test etc.
I've got a requirement to add script to the head of the Master.cshtml file, but not if the environment is development, so I'm wondering how to do this.
I suspect there must be something built in to do this, I've looked I just can't find it.
In startup.cs, I see IWebHostEnvironment offers an EnvironmentName property, but that's in the apps bootstraping code.
Hi.
Some different ways to approached this.
I think I would solve this by using the appsetting. Read more about it here .
You can get a property from the cshtml using the injector like this:
is working on a reply...