Showing Radzen components in Blazor Web Assembly (non-debug)


First time user of Radzen here, just experimenting...and I can't get any components to show in a non-debug mode. For example, menus render with:


I have followed the install instructions, and I am able to see the components in Debug mode.
There are various threads that seem to cover this, for example:

The solution appears always to be invoking UseStaticWebAssets() on the IWebHostBuilder.

However, I have a Blazor WASM with a builder created using:

var builder = WebAssemblyHostBuilder.CreateDefault(args);

There's no method for UseStaticWebAssets on the webAssemblyHostBuilder. Perhaps the problem is something else?

Any help appreciated!

Hi @RadicalOpacity,

You seem to have a problem with publishing your app (or you don't publish at all). During publishing the web assets are copied from the Radzen.Blazor nuget package to your wwwroot directory. You can check the official documentation for static web assets: Reusable Razor UI in class libraries with ASP.NET Core | Microsoft Learn

The easiest way to publish the app is to run dotnet publish in the app directory (where the csproj is). Then everything should be published in the bin\net7.0\publish directory.

Thanks for the response. I'm just running from inside the IDE (Rider). I only do an explicit dotnet publish if i want to actually then upload to the website. The problem with all these links I've seen - including the one you printed is that they all involve invoking ... UseStaticWebAssets - but that method is not available on a WebAssemblyHostBuilder,

And just to reiterate - my debug builds do show the components fine.
Perhaps i need a postbuild step in the run project to copy the content manually from the package to the run folder (though this doesn't feel like the right thing to do)

Yes, using the embedded static web assets requires a web server as they need to be extracted from the package and served.

This is what dotnet publish does already - it extracts the embedded resources and copies them to wwwroot/_content.

I feel this is a general issue with Rider and static web assets which isn't specific just to Radzen.Blazor. Maybe you should look for answers in the Rider community.