According to the documentation:
The
@addTagHelper
directive makes Tag Helpers available to the view. In this case, the view file isViews/_ViewImports.cshtml
, which by default is inherited by all view files in the Views folder and sub-directories; making Tag Helpers available.
So I imported the Tag Helpers in the Views\_ViewImports.cshtml
:
@using MyProject
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
and they work well on files inside the Views
folder.
However, in the file Views/Home/Index.cshtml
, I don't have support for Tag Helpers, neither are they correctly rendered as links. When I copy the _ViewImports.cshtml
into the folder Views/Home
, everything works as expected.
So what am I missing?
Update
So what am I missing? That my _ViewImports.cshtml
was put in the folder Views/Shared
(d'oh). After moving it to Views
, the TagHelpers work as intended everywhere.
asp-controller
andasp-action
. – Ingridingrim