soundaranbu / Razor.Templating.Core

Razor Templating Engine to render Razor Views(.cshtml files) to String in Console, Web, Service, Desktop workloads in .NET Core 3+

Home Page:https://soundaranbu.medium.com/render-razor-view-cshtml-to-string-in-net-core-7d125f32c79

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'

whugarra opened this issue · comments

commented

I saw an example in blazor-server, but when I tried to use the library in blazor-wasm, I immediately received the above error as soon as I installed the package from nuget.

Hi @whugarra,
Thanks for taking your time to try this library. But I'm afraid it's not supported for blazor webassembly. You can use it in blazor server though.

commented

Thank you very much for your quick reply.
Could you please give me some information about why it cannot be used in webassembly?

As you can see from the error message, the library relies on the Microsoft.AspNetCore.App framework reference to render the razor view. This itself can run only on the server side using the ASP.NET Core runtime. As the blazor server runs on the server side using the same runtime, it works. Whereas blazor-wasm runtime runs on the browser and uses a different runtime tailored for the browser. Hence it won't run there.

I hope that it clarifies your question.

commented

Thank you very much for your time and letting me understand the difference between the two frameworks!