I'm trying to make a custom tag helper work in asp-net core 3.0.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace MyProject.TagHelpers
{
[HtmlTargetElement("p", Attributes = "markdown")]
[HtmlTargetElement("markdown")]
[OutputElementHint("p")]
public class MarkdownTagHelper : TagHelper
{
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
output.Content.SetHtmlContent("<p>lkajsdlkjasdlkjasd</p>");
}
}
}
_ViewImports.cshtml
:
@using MyProject
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, MyProject
I'm trying to reference <markdown></markdown>
in the TermsConditions.cshtml
file. (Full file:)
<div>
<markdown></markdown>
</div>
But still, the markdown
tag is never replaced when calling that view.
I found many questions, blogs, ..., but nothing worked so far. I checked for the following common mistakes.
Process
What do I have to do in order to make TagHelpers work?
Everything looks right, from the available information. So I suspect that this isn't actually your assembly name;
@addTagHelper *, MyProject