Hi @Frank Mehlhop ,
Now I try the extract the C# to a newly created NavMenu.razor.cs.
But the cs class is not recognised from the system.
Also Visual Studio does not makes any highlighting at this class.
After extracting the C# code to the NavMenu.razor.cs file, try to run the application, whether the application running success or is there any error? Try to create a new project to test it whether it works well in the new project?
Based on your description, I create a Asp.net 6 Blazor Server application using VS 2022, everything works well. check this screenshot:
and
How can I extract the C# code from NavMenu into a own class?
You can refer the above screenshot to create the class by yourself, or you can also use the VS Quick Actions Extract block to code behind option to extract the C# code to a back-end class file. Refer to this screenshot:
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,
Dillion