Add Blazor support to existing ASP .NET Core 2.1 MVC application

asp.net-core-mvc blazor c#

Question

I was looking at the Microsoft's new Blazor framework. It looks hugely impressive and would really help developers like me that has most of my Background in Desktop. Most of the Examples and tutorials that i see tells you how to start from scratch. I already have an existing .net core(2.1) MVC project with Ef core , Identity a that i wanted to add Blazor support. And i couldn't figure out how to do it. so hereby hoping someone here Might have faced similar issue and figured it or some one more knowledgeable may help me Thank you

Accepted Answer

I wrote a blogpost about that: http://flores.eken.nl/mixing-blazor-and-mvc-pages-in-one-app/

Basically:

In the startup.cs of your site, change the app.UseBlazor() statement to:

app.Map("/bzr", child => { child.UseBlazor<Blazor.Program>(); });

And in the index.html in the wwwroot, alter the base href to:

<base href="/bzr/" />



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why