Peter
Peter

Reputation: 38525

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.

Upvotes: 16

Views: 2954

Answers (3)

Post Impatica
Post Impatica

Reputation: 16423

I had this issue because I wasn't using app.UseStaticFiles(); in my startup

Upvotes: 1

Peter
Peter

Reputation: 38525

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.

Upvotes: 30

Nicolas Law-Dune
Nicolas Law-Dune

Reputation: 1703

If you use .NET CORE 1.0, namespace changes to

"Microsoft.AspNetCore.Mvc.TagHelpers"

Upvotes: 2

Related Questions