Visual Studio .net core tag helpers not working

后端 未结 9 2438
暗喜
暗喜 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:22

    I've finally fixed this, but have no idea why the fixed works or why it stopped working in the first place but...

    in _ViewImports the line which is:-

    @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
    

    I've changed to include quotes:-

    @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
    

    Then I did a rebuild and its working again!?! All the 'asp-' attributes are also now highlighted as they were before. Why?!? Eh?!?

    Stranger still, if I remove the quotes and rebuild, it still works! Well, at least until my colleagues get the file out of source control, they have to put the quotes back in!!

    Figure that one out...

提交回复
热议问题