4
votes

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:

enter image description here

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:

enter image description here

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

2
github.com/aspnet/Razor/issues/1628 - according to this, all you need to do is Repair in the installer. Does not work though, the extension "Razor Extension Service" is still installed and enabled even after repair...Mirek
Doesn't work with 15.3.3 which just got released either...Mirek
Hi Ron, have you tried to re-run the VS 2017 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 like this: 1drv.ms/i/s!Atv5QNuFrncKgyj0dNWd43Pdp4x_Sara Liu - MSFT
@Sara-MSFT - Following the steps you outlined fixed my issue and intellisense is back for tag helpers. Please give this as the answer and I will make it the accepted answer. Thanks!RonC
@RonC, so glad to hear that your issue is solved and I added a reply with the above comment, please mark it when you have free time :)Sara Liu - MSFT

2 Answers

2
votes

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
votes

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