Home > Software design >  Incorporating Blazor custom elements into an ASP.NET MVC application
Incorporating Blazor custom elements into an ASP.NET MVC application

Time:01-13

I am interested in using custom elements as a means of strangling a legacy ASP.NET MVC website so that I can gradually port it to Blazor. However apart from the official documents, enter image description here

Note: For more details you can have a look our official document here.

In addition, for asp.net core and blazor server and web assembly app integration you could check these official document that might be resourceful.

CodePudding user response:

You are missing some steps:

  1. You have to publish the blazor wasm stand-alone project to generate the bin folder.

  2. Copy the bin/xx/net7.0 subfolders to the old app on the root of your content folder (_framework, _content, etc)

  3. On your old app you have to add some lines to the html layout to load the blazor component (also resources if needed (css/js/etc)):

     <script src="_framework/blazor.webassembly.js"></script>
     <script src="_content/Microsoft.AspNetCore.Components.CustomElements/BlazorCustomElements.js"></script>
    

Must been added before the html body end


There is another option to use Blazor without using web component as I explain in the following link

https://medium.com/@santiagoc_33226/using-blazor-wasm-with-net-framework-mvc-or-another-old-external-site-7fc0884fcfca

  • Related