blazor logo

Overview

Walk through taking an existing asp.net mvc app and adding server side blazor support.

Pre-requisits

  • an existing asp.net mvc app running .net 5

New files

_Imports.razor

default using statements for blazor components

App.razor

blazor routing

Pages/Counter.razor

blazor component

Changed files

startup.cs

add blazor server side (no default blazor routing as routing handled by mvc)

Index.cshtml

add blazor component to existing mvc view

Notes

  • this post demonstrates adding a blazor component to an existing mvc view page
  • original mvc code base is mvc visual studio template
  • additional code comes from blazor server side visual studio template
  • this is not client side blazor aka wasm
  • watch out for casing; blazor components must start capitalized

Code links

References