Copied to clipboard

Flag this post as spam?

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


  • Marcus 42 posts 183 karma points
    Apr 28, 2024 @ 06:17
    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 1875 posts 6421 karma points MVP 2x c-trib
    Apr 29, 2024 @ 13:57
    Huw Reddick
    0

    Hi Marcus,

    What version of Umbraco are you using?

  • Marcus 42 posts 183 karma points
    Apr 30, 2024 @ 15:15
    Marcus
    0

    Hi Huw,

    I have just upgraded to 13.3.0

  • Huw Reddick 1875 posts 6421 karma points MVP 2x c-trib
    May 01, 2024 @ 09:10
    Huw Reddick
    1

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

  • Luuk Peters 85 posts 327 karma points
    May 01, 2024 @ 07:19
    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 42 posts 183 karma points
    May 02, 2024 @ 10:45
    Marcus
    0

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

  • Huw Reddick 1875 posts 6421 karma points MVP 2x c-trib
    May 02, 2024 @ 13:22
    Huw Reddick
    0

    By default it will be the name of your project

  • Marcus 42 posts 183 karma points
    May 03, 2024 @ 11:36
    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 1875 posts 6421 karma points MVP 2x c-trib
    May 03, 2024 @ 12:11
    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 42 posts 183 karma points
    May 05, 2024 @ 06:03
    Marcus
    0

    Okay noted,

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

    Thanks again

  • Huw Reddick 1875 posts 6421 karma points MVP 2x c-trib
    May 05, 2024 @ 06:31
    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