Visual Studio .net core tag helpers not working

后端 未结 9 2478
暗喜
暗喜 2021-02-19 00:49

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

9条回答
  •  一生所求
    2021-02-19 01:39

    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.

提交回复
热议问题