Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Environment tag dosent work?

What is required to get the environment tag to work?

<environment names="Staging,Production">
    <link type="text/css" rel="stylesheet" href="~/lib/materialize/dist/css/materialize.min.css" media="screen,projection" />
    <link type="text/css" rel="stylesheet" href="~/css/Style.css" media="screen,projection" />
</environment>

Its just rendered just as i wrote it in a .cshtml and not filtered based on the Environment i specified.

like image 689
Peter Avatar asked May 10 '16 14:05

Peter


People also ask

How do I enable environment variables?

On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.

What is environment tag in HTML?

The Environment Tag Helper conditionally renders its enclosed content based on the current hosting environment. The Environment Tag Helper's single attribute, names , is a comma-separated list of environment names. If any of the provided environment names match the current environment, the enclosed content is rendered.

What can I use instead of environment variables?

Instead of environment variables, we recommend that you either use a YAML configuration file or a shared data source.

Does jest use environment variables?

If you use Jest as your trusty testing framework for your Node. js application, you probably ended up in the situation where the code you are trying to test, uses environmental variables that you access with process. env .


1 Answers

It seems you need to add @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" to the file containing the html, or if you follow the setup of a default project add it to _ViewImports.cshtml.

Also make sure you have added Microsoft.AspNetCore.Mvc.TagHelpers to your project.json.

like image 50
Peter Avatar answered Sep 29 '22 01:09

Peter