Reputation: 167
I'm working on a project. Converting a Core 2.1 to .NET 6. It's going pretty well. I noticed that taghelpers are not working. We use a lot of Anchor tags. Every time I search it comes up that I need to add the line
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
to my _ViewImports.cshtml. But it is in there and always has been. Intellisense doesn't recognize the taghelpers either. According to the .net6 documentation it is still part of .NET 6. When I check the Nuget packages I can install Microsoft.AspNetCore.Mvc.TagHelpers but it has a .NET version of 2.0. So I doubt I should install that.
Any idea's how to get these taghelpers working again?
Upvotes: 2
Views: 1418
Reputation: 11
The fix ended up being simple – just copy paste a suitable _ViewImports.cshtml under your /Views -folder. This resolved my issue.
The _ViewImports.cshtml file is required in the folder your Views are in, or its parents. The example I was working with only included _ViewImports -files under /Pages and its subfolders.
Upvotes: 0
Reputation: 1122
We're using Microsoft.AspNetCore.Mvc.TagHelpers 2.2 and they work fine. The package has a NETStandard library. This means its backwards compatible.
>= 2.2.0
means any version above 2.2.0
Upvotes: 4