is it possible to use blazor C# on the MVC View cshtml instead of .razor files? RRS feed

  • Question

  • User2110873642 posted

    i created a blazor project, and added the MVC Models, Views, Controllers folders. and registered the routing at startup.cs. and all seems to work fine when navigating the urls. (usually this is done the other way around, by starting with a MVC project, and installing blazor, but this seems more complicated to me?)

    unfortunately, im comming from web forms, and never seen razor syntax before. and i dont understand how to use blazor in MVC from here on.

    is it possible to use blazor C# on the Views? or do i need to frame .razor files inside the views? and can i put .Razor files in the "\Views\Home" Folder or does it only work in the \Pages folder?

    Sunday, July 19, 2020 6:59 PM


  • User-821857111 posted

    You wouldn't normally mix Blazor with MVC Views. It is possible to render a Blazor Component in MVC view, but you would only really do that if you had a killer Blazor component and no standard MVC-enabled alternative. That is highly unlikely unless you get a really expensive commercial component, and even then, The Blazor versions are likely to be based on existing MVC components.

    If coming from Web Forms, your first decision is whether to use MVC, Razor Pages or Blazor. in my opinion. And to answer that, you need to understand each of them. You should work through some examples of each without mixing them up and causing yourself unnecessary complexity and confusion.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 20, 2020 3:01 PM