Tag helper syntax is not working for the Areas view in ASP.NET Core

Posted by Sheonarayan under Error and Solution on 10/17/2016 | Points: 10 | Views : 64 | Status : [Administrator] | Replies : 0


If you have newly created an Area in the ASP.NET Core project and added a view and trying to use Tag helper codes to create links such as this

<a asp-action="Details" asp-area="Admin" asp-controller="Vendors">Details</a>

The chances are it will not work (even Tag Helper intellisense doesn't work), you will get the same raw code as an output.


The solution of this problem is to copy ~/Views/_ViewImports.cshtml to ~/AreaName/Views/_ViewImports.cshtml

This is because the Tag helper is made available because of @addTagHelper that is available in the _ViewImports.cshtml page.

Once you have done this, your Tag helper intellisense works as well as your Tag Helper code works!

Hope this helps.

Sheo Narayan


(No response found.)

Login to post response