Well, lets get down to it. I\'m using Visual Studio 2015 and ASP.NET core tag helpers have completely stopped working, no idea why as I\'ve not changed anything. I was in work o
Here's good contender for the dumbest way to cause Tag Helpers to ignore you in disdain. Try commenting out an individual HTML attribute...
<input id='@Model.InputId.Records[0].TenantId'
class='class-1'
@*class='class-2' THIS WILL NEGATE THE asp-for ATTRIBUTE BELOW *@
asp-for="@Model.Records[0].TenantId"
type='text'
placeholder='Required.' />
I noticed that the tag helpers only helped for some views as @MayBeNextTime kindly informed us. Although, @Menace advises to add duplicates of the _ViewImports file to every Area you have views in, in order for the tag helpers to work for every view you have in your application, I found that by moving the _ViewImports file to the main application folder (right next to/or above Program.cs , Startup.cs , appsettings.json in your Solution Explorer) that you will achieve ubiquitous tag helpers' functionality without creating duplicate files in your app.
Check this out:
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-2.2
It says:
A _ViewImports.cshtml file can be placed within any folder, in which case it will only be applied to pages or views within that folder and its subfolders.
If you are experiencing the same problem when using Areas, add the _ViewImports
file to the Views
folder of your Area