MVC 6 Tag Helpers Intellisense?
Asked Answered
D

6

13

Is there supposed to be Intellisense for the new asp- tag helpers in Razor/MVC 6? I was following along on one of Shawn Wildermuth's courses on Pluralsight and everything functions properly, but I thought I should be getting intellisense when I start typing asp- as an attribute on a tag.

If it should be there do you have any ideas on what might cause it to disappear?

I'm using Visual Studio 2015 Community, and RC1-Final versions of the .Net dependencies for Kestrel, Mvc, and TagHelpers.

Diaeresis answered 4/12, 2015 at 22:28 Comment(0)
W
11

Make sure you add "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final" to your project.json dependencies.

You also need to add @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" to your _ViewImports.cshtml to make the tag helpers available in al your views.

You can get more information at aspnet 5 documentation page

Wernsman answered 5/12, 2015 at 20:41 Comment(2)
Was missing the first step. Thank you!Diaeresis
Do you have a one colour for tag name, and attributes after using the taghelper ? Can I change it somehow ? Can I change it do differentiate them from each other ?Unaccountedfor
J
8

In my case it was ReSharper, disabling I get Intellisense back

Judon answered 8/2, 2016 at 20:30 Comment(1)
It is "fixed" in ReSharper v2016.2. In VS go: ReSharper -> Options -> Products & Features. There you can uncheck ASP.NET Razor, restart VS and done!Tetracaine
F
3

Another thing, ensure that @addTagHelper in _ViewImports.cshtml is unquoted, for example: @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" ----not good

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers ---good

This fixed mine...

https://github.com/aspnet/Tooling/issues/484

Famish answered 25/1, 2017 at 20:4 Comment(0)
A
2

In my case, my project did not use the project.json, I use Visual Studio 2017 with the csproj file.

I simply needed to install (Tools -> Extentions and Updates...) this tool for Visual Studio (Razor Language Services):

enter image description here

After I did that, I restarted Visual Studio, it installed the tool and then I got the intellisense working.

Apple answered 26/4, 2017 at 9:27 Comment(0)
P
0

You need to also have

"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},

in your project.json dependencies, you can see all of the steps here: https://mcmap.net/q/904809/-tag-helpers-disabled-in-vs-2015

Picnic answered 20/10, 2016 at 6:39 Comment(0)
T
0

In my case I needed to deactivate the IntelliSense of ReSharper (9.2) which overrides the TagHelpers.

Steps in the Visual Studio 2015 Menu:

  • Go to ReSharper -> Options... -> IntelliSense -> General
  • Check "Custom IntelliSense"
  • Except HTML I changed dropdown entries to "ReSharper"
  • Restart Visual Studio

The cshtml Razor page TagHelpers are now no longer overridden by ReSharper IntelliSense.

Trombone answered 16/11, 2016 at 10:50 Comment(2)
in visual studio 2015 in normal option there no IntelliSenseImpeach
I wrote that in my case "ReSharper" was the problem and the "IntelliSence"-Option can be found in the Resharper-Options.Siouan

© 2022 - 2024 — McMap. All rights reserved.