Simple tag helper "suddenly" no longer renders properly (only in production, only for one page)

Viewed 138

As the title states, I'm having a finicky issue with .NET Core 2.2. I'm using tag helpers all over, but on the specific page that I'm having trouble with, it's actually the most simple use-case of all:

<a class="logout" asp-page="/Admin/Logout">Logout</a>

Some relevant notes:

  • As of yesterday, it worked in all environments without any issues.
  • This morning I made some changes seemingly unrelated to this page, and published again.
  • In the published version (on Azure), the tag helpers for this page only don't render, but instead appear in the source code as literals. (e.g. <a asp-page="..."></a>)
  • Still works without issue locally.

Here is the directory structure. The page in question is /Admin/Index.cshtml:

enter image description here

And my _ViewImports.cshtml (which again, I haven't changed in months):

@using redacted
@namespace redacted.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
1 Answers

Explicitly adding the taghelper to the .chshtml file has solved this for me in the past. Unfortunately I am not aware of why this issue occurs randomly. In my specific use case,we were using custom and third party tag helpers which we suspect was causing the issues.

Try adding this line to the /Admin/Index.cshtml file:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Related