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...");
}
}
}