0
votes

I understand completely how _viewimports works and I have that set properly. In previous versions of Visual Studio, if you targeted a primitive tag helper (like p or body), it would turn purple. In the current version, this is not the case. I put together a sample project in github and also reported it to Microsoft through the report bug feature of Visual Studio.

I'm just wrapping up my update to my Pluralsight Tag Helpers course and want to know if there is something obvious I'm missing, otherwise, I guess I'll wait to hear back from Microsoft.

Below is a screen shot that shows the problem and that the two tag helpers I wrote ("peter" and "p") are both working and their process methods are executing. However, as you can see, the p tag is not showing in purple.

Here is a link to the github repo that shows this issue:
https://github.com/pkellner/vs2019-taghelpers-notpurple

And here is the view page that I'm showing.

@{
        ViewData["Title"] = "Home Page";
}

<div class="text-center">
        <peter>THIS IS THE PETER TAG HELPER ON VIEW PAGE</peter>
        <p>THIS IS THE P TAG HELPER ON VIEW PAGE</p>
</div>

and the p tag helpers not showing in purple but running

using Microsoft.AspNetCore.Razor.TagHelpers;

namespace TagHelpersNotPurple
{
    // You may need to install the Microsoft.AspNetCore.Razor.Runtime package into your project
    [HtmlTargetElement("p")]
    public class PTagHelper : TagHelper
    {
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.Content.AppendHtml("...p tag helper...");

        }
    }
}

enter image description here

1
It works in vs 2019 preview but not in vs 2019 16.2.2.Maybe you need to ask the problem under visual studio tag or its teamRyan

1 Answers

1
votes

Visual Studio removed colors for built in HTML elements because Blazer was colorizing all the elements and the team did not like that.

Now, you have to type an attribute and see it turn purple to know if it's discovered as a built in tag helper. Problem is, it could still be a tag helper with no attributes and now, you'd never know it.

I wish there as a "Blazer Mode" I could turn off then I could just to what I'm use to doing and not have Blazer issues get in the way of my nice razor html pages.