Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

@addTagHelper not working for environment tag in _Layout.cshtml. #1200

Closed
rjamesnw opened this issue Apr 10, 2017 · 6 comments
Closed

@addTagHelper not working for environment tag in _Layout.cshtml. #1200

rjamesnw opened this issue Apr 10, 2017 · 6 comments

Comments

@rjamesnw
Copy link

rjamesnw commented Apr 10, 2017

Just to confirm, is it still necessary to put @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers at the top of the _Layout.cshtml file? I tried putting it at the top of _ViewImports.cshtml and it doesn't work. It only works in the _Layout.cshtml file.

Also, are quotes still required? The doc shows both, but I thought I read somewhere it's not the default (so I can only assume it's not defaulted for a reason).

I was following this but it doesn't help: dotnet/aspnetcore#534

@NTaylorMullen
Copy link
Member

As long as your _Layout.cshtml is a sibling or a grand child of your _ViewImports.cshtml file you should not need to add an @addTagHelper statement to it.

@rjamesnw
Copy link
Author

And what about the second question - are quotes optional? (i.e. @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"). I noticed by default there are no quotes when a new project is created. What is preferred?

@NTaylorMullen
Copy link
Member

Yes, quotes are optional. There's currently a bug open about not having quotes and not being able to hit enter at the end of the directive line. Therefore, until that's fixed I'd say write your directives with quotes; after that, whatever your own preference is 😄

@rjamesnw
Copy link
Author

Ok, thanks.

@rjamesnw
Copy link
Author

rjamesnw commented Apr 10, 2017

As for the other issue, it appears the view imports was being loaded from an assembly (via the embedded file provider) and not the main project, causing the issue. It's working now, I appreciate all your help, thanks. ;)

@NTaylorMullen
Copy link
Member

Glad everything is working @rjamesnw 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants