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.
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.
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.
Instead of environment variables, we recommend that you either use a YAML configuration file or a shared data source.
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 .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With