Asp.Net core 2.0 MVC anchor tag helper not working

删除回忆录丶 提交于 2019-12-04 03:35:07

问题


I am trying to create a demo page, and can't solve the next problem, and I tried everything what I found on the web. I have an anchor tag with tag helper:

<a class="menu-link" asp-area="" asp-controller="Telefon" asp-action="Index">Telefonok</a>

I also added a _ViewImports.cshtml and in it I added as I saw in the net @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers", but I still got an error: The name 'addTagHelper' does not exist in the current context

What did I wrong?!


回答1:


There are two _ViewImports.cshtml, you probably need the one located in the Views Folder.

In my project I have a another one under Views/Manage

Also the line required should be as follows:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

This I believe means it will include all of the Tag Helpers in the namespace.

Note the use of the Asterix (*)



来源:https://stackoverflow.com/questions/49540860/asp-net-core-2-0-mvc-anchor-tag-helper-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!