-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
While I was experimenting on embedding blazor client side (wasm) in an existing mvc app, it seems that it is close enough to be easily implemented, however some changes are needed to have this scenario supported (in which I am very interested).
For example, the following scenario kinda works:
Having 2 projects, an mvc core app and a blazor clientside app
Mvc App (references the blazor client project)
//Startup.cs
app.UseClientSideBlazorFiles<Client.Startup>();<!-- Shared/_Layout.cshtml -->
<head>
<!-- ... -->
<base href="~/" />
<!-- ... -->
</head>
<body>
<!-- ... -->
<script src="_framework/blazor.webassembly.js"></script>
</body><!-- Home/Index.cshtml -->
<counter>Loading ...</counter>
@*Or using prerendering*@
@*<counter>@(await Html.RenderStaticComponentAsync<Counter>())</counter>*@Blazor Client App
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<Counter>("counter");
}
}This works fine for the Index.cshtml page however if you navigate to an other page (or add another component) you get an exception like this
WASM: Error: Could not find any element matching selector 'counter'.
Describe the solution you'd like
Full support for embedding blazor client-side (wasm) in existing MVC applications.
IMHO it will help with adoption tremendously and is a very nice alternative for people who do not want to use server-side blazor to do the same thing.