Asp.Net Core 2.0 MVC锚标记助手不起作用 [英] Asp.Net core 2.0 MVC anchor tag helper not working

查看:142
本文介绍了Asp.Net Core 2.0 MVC锚标记助手不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建演示页面,但无法解决下一个问题,因此我尝试了在网上找到的所有内容。
我有一个带有标签助手的锚标签:

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>

我还添加了 _ViewImports.cshtml ,并在其中添加了在网上
@addTagHelper *,Microsoft.AspNet.Mvc.TagHelpers 中看到了,但是我仍然遇到错误:名称'addTagHelper'在当前不存在

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

我怎么了?!

推荐答案

有两个_ViewImports.cshtml,您可能需要一个位于Views文件夹中的。

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

而且所需的行应如下:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

我相信这意味着它将包含名称空间中的所有Tag Helpers。

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

请注意使用Asterix(*)

Note the use of the Asterix (*)

这篇关于Asp.Net Core 2.0 MVC锚标记助手不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆