Custom tag helper not working

前端 未结 8 1416
抹茶落季
抹茶落季 2021-02-03 19:11

I followed a few guides on creating a custom tag helper for ASP Core.

This is my helper:

using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Asp         


        
8条回答
  •  庸人自扰
    2021-02-03 19:31

    A way you can make the search for your TagHelpers a bit quicker is to provide the namespace that your tag helpers live in instead of the asterisk, which will look everywhere in your assembly.

    @addTagHelper com.excellor.TagHelpers.*, excellor
    

    Where excellor is the assemblyname and com.excellor.TagHelpers is the namespace the tag helpers reside in.

    Note, the following entry is NOT needed as long as you are namespacing your tag helpers.

    @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
    

提交回复
热议问题