I would like to know how do I publish a Blazor WebAssembly application with ASP.Net Core Hosted checked. The big problem is that in the application they have 2 projects, and I don't know which one to publish, or how to merge between them when publishing.
Publish the Server app.
When you look in its \bin\Release folder you will see the Client related DLLs as well.
Don't overthink it.
You need to publish your Server project.
But it must have a reference to your Client's project.
In versions < 3.2.0 you must also register Blazor on your server application.
Here's how to register it in your server Startup
(Replace Client with the proper namespace in your Blazor project):
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBlazorDebugging();
}
app.UseStaticFiles();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With