Tag helper intellisense in VS 2017 ver 15.3.x not working

て烟熏妆下的殇ゞ 提交于 2020-01-03 17:03:36

问题


In past versions of Visual Studio 2017 if a developer wanted to have tag helper intellisense they needed to install Razor Language Services as indicated in this SO answer: ASP.NET Core Tag Helper Intellisense in Visual Studio 2017 In prior versions of VS 2017 I did this and it worked great.

Recently I upgraded to Visual Studio 2017 version 15.3.2 from version 15.2 I believe and now my tag helper intellisense is no longer working.

I read here https://developercommunity.visualstudio.com/content/problem/55761/tag-helpers-intellisense-still-doesnt-work.html that in 15.3 tag helper intellisense was going to work out of the box. But in my case it does not.

To try to get it working I tried disabling Razor Language Services (thinking maybe it's not needed now) but then Visual Studio wouldn't let me open any cshtml files and complained with the following dialog:

So I re-enabled Razor Language Services but I am still unable to get tag helper intellisense working in the latest version of Visual Studio 2017 which is currently version 15.3.2. Below is a simple tag helper with no tag helper coloring:

Any suggestions on how to get Tag Helper intellisense working in this version of Visual Studio?


回答1:


Refer to this, please re-run the Visual Studio Installer as administrator and click More - Repair to repair, I tried to install the Razor Language Services extension to made the Tag Helper intellisense works in VS 2017 15.2, then upgrade it to the latest version 15.3.3 and just like you found, this intellisense not works, but after I repair the VS 2017 15.3.3 and restart the computer as VS required, then I check the Tag Helper Intellisense works again in my existing or new projects in here.




回答2:


Is it possible that you have mixed namespaces and assembly names? I did not know that @addTagHelper consumes an assembly name, not a namespace which was apparently my mistake, tag helpers intellisense works well right now.

So in your _ViewImports.cshtml, instead of this

@addTagHelper *, YourApp.Some.Namespace

Should be this

@addTagHelper *, YourAssemblyNameInApplicationProperties


来源:https://stackoverflow.com/questions/45940963/tag-helper-intellisense-in-vs-2017-ver-15-3-x-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!