The type or namespace name RenderModeInteractiveServer could not be found(are you missing an assembly reference?)

NISSOU09 40 Reputation points
2024-04-04T01:24:22.3066667+00:00

i want to use the @attribute [RenderModeInteractiveServer] but the error keep popping up and i don't even understand the probleme how can i fix it

extra details :

i tried to replace it with @rendermode InteractiveServer it worked in one file but in the new file it did not and i need to use the first one to continue with the toturial

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,419 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ping Ni-MSFT 2,330 Reputation points Microsoft Vendor
    2024-04-04T01:49:38.37+00:00

    Hi @NISSOU09,

    i tried to replace it with @rendermode InteractiveServer it worked in one file but in the new file it did not and i need to use the first one to continue with the toturial

    By default in .NET 8, you need use @rendermode attribute instead of @attribute [RenderModeInteractiveServer]. Did your project migrate to .NET 8 and what is the targetframework?

    Check the _Imports.razor:

    @using static Microsoft.AspNetCore.Components.Web.RenderMode
    

    Besides, if you want the whole application apply to one rendermode, you can use the following code in App.razor:

    <Routes @rendermode="new InteractiveServerRenderMode()" />
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Best regards,
    Rena

    0 comments No comments