Так что, если вам нравится, у меня есть эти / Pages + / Views концепции, обязательно просмотрите все эти _ViewImports.cshtml. Надеюсь, что оставление этой заметки напомнит уставший мозг кого-то другого, и если это помогло сделать перерыв и пойти на прогулку или вздремнуть.

довал нескольким инструкциям по созданию настраиваемого помощника по тегам для ASP Core.

Это мой помощник

using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;

namespace ToolControlSystem.TagHelpers
{
    [HtmlTargetElement("description", Attributes = DescriptionAttributeName, TagStructure = TagStructure.NormalOrSelfClosing)]
    public class DescriptionTagHelper : TagHelper
    {
        private const string DescriptionAttributeName = "asp-for";


        [HtmlAttributeName(DescriptionAttributeName)]
        public ModelExpression Model { get; set; }

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            base.Process(context, output);

            var description = GetDescription(Model.ModelExplorer);

            output.TagName = "span";
            output.TagMode = TagMode.StartTagAndEndTag;
            output.Content.SetContent(description);
        }

        private string GetDescription(ModelExplorer modelExplorer)
        {
            string description;
            description = modelExplorer.Metadata.Placeholder;

            if (String.IsNullOrWhiteSpace(description))
            {
                description = modelExplorer.Metadata.Description;
            }

            return description;
        }
    }
}

Я бросаю это в_ViewImports.cshtml: @addTagHelper *, ToolConstrolSystem.TagHelpers

Annnndd ... ничего. Нет смысла, нет замены тега ...

Есть идеи?

Ответы на вопрос(3)

Ваш ответ на вопрос