且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

标记助手在ASP.NET Core 2中未得到处理

更新时间:2023-12-05 21:57:58

注册标签助手时,需要的是 assembly ,而不是名称空间-在 docs

When registering Tag Helpers, it’s the assembly that is required, not the namespace - explained in the docs.


...第二个参数 Microsoft.AspNetCore.Mvc.TagHelpers指定包含标签的程序集帮手。 Microsoft.AspNetCore.Mvc.TagHelpers是内置ASP.NET Core标记帮助器的程序集。

...the second parameter "Microsoft.AspNetCore.Mvc.TagHelpers" specifies the assembly containing the Tag Helpers. Microsoft.AspNetCore.Mvc.TagHelpers is the assembly for the built-in ASP.NET Core Tag Helpers.

因此,您可以更改以下内容:

So in your case, you can just change this:

@addTagHelper *, X.TagHelpers

为此:

@addTagHelper *, X