C# Can';t让标记助手在.NETCore2.1中工作
我一直在尝试让标记助手工作,但不管我做什么,它们在intellisense中都无法识别,生成html的代码中没有断点,元素也不会转换 这是我的EmailTagHelper.csC# Can';t让标记助手在.NETCore2.1中工作,c#,asp.net-core,asp.net-core-tag-helpers,C#,Asp.net Core,Asp.net Core Tag Helpers,我一直在尝试让标记助手工作,但不管我做什么,它们在intellisense中都无法识别,生成html的代码中没有断点,元素也不会转换 这是我的EmailTagHelper.cs using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.TagHelpers; namespace eHealthy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace eHealthy.TagHelpers
{
public class EmailTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "a"; // Replaces <email> with <a> tag
}
}
}
这是我尝试调用帮助程序的页面
@model EditViewModel
@{
ViewBag.Title = "title";
Layout = "_Layout";
}
@*<h2>title</h2>*@
<form method="post">
<email>
potato
</email>
</form>
<input type="hidden"/>
@model EditViewModel
@{
ViewBag.Title=“Title”;
布局=“_布局”;
}
@*头衔*@
马铃薯
取消您添加的标记帮助程序。删除eHealthy.TagHelpers助手,您甚至不需要创建它
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
默认情况下,新标记帮助程序会出现在该命名空间中吗?哦,对不起,不会,它们不会自动添加。您必须重新添加第二个taghelper,但不要在@addTagHelper行中使用引号。
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers