I cannot get a custom TagHelper to work in my ASP.NET v5 project. The custom TagHelper is located in the web project itself. I tried following this sample this sample from CodeProject and this tutorial too.
When I try to use the tag without addTagHelper
:
nothing is transformed, no breakpoints hit in the tag helper.
When I try to @addTagHelper "*, MyWebApplication"
to the Viewcomponent, the error is MyWebApplication'. Error: Could not load file or assembly 'MyWebApplication'
.
What am I missing?
Tool versions:
Microsoft Visual Studio Enterprise 2015 RC
Version 14.0.22823.1 D14REL
Microsoft .NET Framework Version 4.6.00057
Microsoft.AspNet.Mvc 6.0.0-beta4
The advertised signature for addTagHelper is
@addTagHelper "className/Filter", "assemblyName"
Behaviour actually appears to be (at least for helpers in same web project)
addTagHelper "className/Filter", "folderName"
because at least into Beta6, the assembly name is the folder name and ignores the attributes in the project properties.
Here is a sample working demo
TagHelperDemo
->
TagHelperFolderDemo
addTagHelper
directivePS: @addTagHelper
is required even when the TagHelper
is in the same project. VS2015 re-colours the tag as purple when it is targeted by a TagHelper
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With