Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marcus 34 posts 175 karma points
    15 days ago
    Marcus
    0

    Umbraco - Cannot render basic tag helper

    Hi all,

    I'm trying to create a super simple tag helper and render it into my view template as follow:

    enter image description here

    I also added in _ViewImports.cshtml already

    enter image description here

    But It cannot be rendered in my view

    enter image description here

    I tried the same thing in a new project created with Razor Pages template and it works

    Could you please let me know why?

    Thanks!!!!

  • Huw Reddick 1770 posts 6136 karma points MVP c-trib
    1 week ago
    Huw Reddick
    0

    Hi Marcus,

    What version of Umbraco are you using?

  • Marcus 34 posts 175 karma points
    1 week ago
    Marcus
    0

    Hi Huw,

    I have just upgraded to 13.3.0

  • Huw Reddick 1770 posts 6136 karma points MVP c-trib
    1 week ago
    Huw Reddick
    1

    try just using @addTagHelper *, MyProject that works for me

  • Luuk Peters 84 posts 325 karma points
    1 week ago
    Luuk Peters
    1

    If you use the project/assembly name in the _ViewImports.cshtml? I see that the namespace of your tag helper is MyProject.TagHelpers, but is that also the assembly name?

  • Marcus 34 posts 175 karma points
    1 week ago
    Marcus
    0

    MyProject is the example namespace I replaced to capture screenshot. How to know that is assembly? Thank you

  • Huw Reddick 1770 posts 6136 karma points MVP c-trib
    1 week ago
    Huw Reddick
    0

    By default it will be the name of your project

  • Marcus 34 posts 175 karma points
    1 week ago
    Marcus
    100

    I found that

    In case the project/namespace contains "_" character so the assembly name will be replaced by "-".

    In my case my_project namespace should be my-project in _ViewImports.cshtml.

    For example:

    @addTagHelper *, my-project

    Thank you all !!!

  • Huw Reddick 1770 posts 6136 karma points MVP c-trib
    1 week ago
    Huw Reddick
    0

    I think you may be misunderstang the problem exactly even though you have solved it.

    If I create a VS project called My_Project then the assembly name created when built is still My_Project, it does not replace the _ with a -

  • Marcus 34 posts 175 karma points
    1 week ago
    Marcus
    0

    Okay noted,

    I published the project and checked .dll file in publish folder to know exactly assembly name.

    Thanks again

  • Huw Reddick 1770 posts 6136 karma points MVP c-trib
    1 week ago
    Huw Reddick
    0

    that is good, but nothing in the build or publish process changes the _ to a -

Please Sign in or register to post replies

Write your reply to:

Draft