33
loading...
This website collects cookies to deliver better user experience
We are in the process of building a Blazor.Net5 server application alongside a number of existing web projects (Blazor, Angular, html etc). We would like the Blazor application to be the only application the users go to and access the other sites from it.
I wanted to create a Blazor…
MicroFrontendsExample
.MicroFrontendsExample.Shell
.
Note that this particular project will serve as our app shell.MicroFrontendsExample
.ReactMicroFrontend
in our case) and click 'Next'HTML
- only .razor
. ReactMicroFrontend
as a Project Reference to the main Blazor App. This will enable the container app or app shell recognize our class library as a part of itself (in layman's terms).MicroFrontendsExample.Shell
) Add > Project Reference
. ReactMicroFrontend
in our case). Microsoft.AspNetCore.Components.Web
NuGet package into the Class Library.open in terminal
. In the opened terminal, enter:dotnet add package Microsoft.AspNetCore.Components.Web --version 5.0.12
Edit Project File
.<!-- add ".Razor" to the Sdk attibute of the <Project> tag, just like below -->
<Project Sdk="Microsoft.NET.Sdk.Razor">
...
<!-- Add the block below -->
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<!-- -->
...
</Project>
Class1.cs
file. App.razor
) and the _Imports.razor
file.wwwroot
. wwwroot
folder, create another folder called dist
.src
folder.The App.razor
file is the entry point of the React Application. It is through this file that the react application is loaded onto the blazor wasm framework.
The _imports.razor
file contains any namespace we'd want available throughout the scope of the Class Library.
The ‘wwwroot’ folder contains a ‘dist’ folder where the bundled react app is placed after the react app is built with ‘npm run build’.
The ‘src’ folder is where the react application/codebase resides.