Questions tagged [blazor-webassembly]

There are two hosting models for Blazor apps: server-side (often pre-rendered) and client-side (WebAssembly). Because of the different hosting environments, something what may work on the client-side might not on the server-side, and vice versa. Use this tag for questions specific to client-side hosted Blazor apps.

1093 questions
37
votes
7 answers

Is there any hot reload for blazor server-side?

I have just one, quick question. Is there way to hot reload a blazor app? At least, .razor files? Now I'm hosting my app on local IIS (not IIS express). I was looking through internet, but i didn't found anything helpful. Thank you all for anwsering…
18
votes
8 answers

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

Trying to migrate from ASP.NET Core 3.1 to 5.0 using this guide provided by Microsoft. Installed SDK 5.0.100-rc.1 with runtimes. Updated project as guide says and still getting following error: There was no runtime pack for Microsoft.AspNetCore.App…
Kasta
  • 1,086
  • 1
  • 10
  • 22
12
votes
5 answers

Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.6.2

I have Visual Studio 2019 16.6.2 installed, along with the .NET Core 3.1.301 SDK and all the necessary Blazor templates. If I create a brand new Blazor WebAssmbly application, I can run it from Visual Studio by pressing Ctrl+F5 and it opens a new…
11
votes
1 answer

StateHasChanged() vs InvokeAsync(StateHasChanged) in Blazor

I know that calling the StateHasChanged() method notifies the component that the state has changed and that it should re-render. However, I also see calls to await InvokeAsync(StateHasChanged) or await InvokeAsync(() => StateHasChanged()) in other…
Arad
  • 1,815
  • 2
  • 19
  • 39
11
votes
2 answers

Blazor WebAssembly: The provided ContentType is not supported;

I have installed the Blazor WebAssembly Example Project (WeatherForecast) today by the following command line: dotnet new blazorwasm --hosted -o ProjectName I started the SPA directly after the installation via Visual Studio 2019 in Debug Mode. The…
9
votes
0 answers

Blazor WebAssembly App with docker support (linux)

Today I have a question which is one of those questions, that you always did want to know but you were always afraid to ask;) But this question is also correlated with BlazorWebAssembly app docker support. So maybe I will describe what I did. SO I…
Piotr
  • 875
  • 6
  • 24
8
votes
2 answers

Blazor Web Assembly App .Net Core Hosted: publish runtime error

I've created a simple Blazor Web Assembly project hosted inside a .NET Core App using .NET 5.0 RC1 Framework and I added the authorization during the wizard in Visual Studio 2019 Preview. It works perfectly in debug but if I publish it and try to…
8
votes
3 answers

Blazor, how can I trigger the enter key event to action a button function?

I was trying the todo-list example from Microsoft: https://docs.microsoft.com/en-us/aspnet/core/tutorials/build-a-blazor-app?view=aspnetcore-3.1 I want to add a todo item and instead of pressing the button with a mouse click I want to press the…
8
votes
1 answer

Enforcing Blazor webassembly to use Newtonsoft.Json on client side

In Blazor webassembly is there a way to enforce the use of Newtonsoft.Json serlialization for httpclient and methods such as GetJsonAsync, PostAsJsonAsync etc. Or the only way is to write helper methods and use GetAsync and then serialize the…
mko
  • 4,825
  • 8
  • 45
  • 97
6
votes
2 answers

NET5.0 Blazor WASM CORS client exception

I have a Blazor WASM app and a Web Api to get called by Blzor via HttpClient. Both programs run on the same machine (and also in production environment which should not be to exotic for a small business application!). Calling the Web Api from the…
tomschrot
  • 89
  • 1
  • 3
6
votes
1 answer

How to authorize user's role in client side of blazor wasm?

Environments Asp.Net Core 5.0 Blazor WebAssembly App (Asp.Net Core Hosting) Asp.Net Core Identity (with Identity Server 4) Problem I want to use Role-based authorization between Server side and Client side. I can login correctly and…
user14622931
6
votes
1 answer

Run Blazor WASM as Blazor Server-Side

NOTE: This is a "Share your knowledge - Q&A style" post. I probably got a downvote because someone misinterpreted the context of this post :( Problem Blazor WASM could've been easily preferred over Blazor Server-Side without its downsides…
DaaWaan
  • 441
  • 2
  • 16
6
votes
2 answers

NETSDK1073: The FrameworkReference 'Microsoft.AspNetCore.App' was not recognized

I use .NET Core 5.0.100-preview.7.20366.6 , Blazor webassembly, Microsoft Visual Studio Community 2019 Preview Version 16.7.0 Preview 6.0 file foo.csproj
Do Nhu Vy
  • 33,131
  • 37
  • 143
  • 202
6
votes
3 answers

Blazor Navigationmanager cancel navigation on locationchanged

Question: Is there a way on Blazor to cancel navigation? Let's supose a siple a href like this: Go I would like to cancel navigation (for example if we are editing a form) What I have tried. Via JS I set…
dani herrera
  • 39,746
  • 4
  • 87
  • 153
6
votes
1 answer

How to use either ?. or ?? to conditionally render Blazor template?

I want to simplify the following @if (Template != null) { @Template } else { No contents! } with either ?? or ?. Is it possible? Attempt My attempts below @Template?.BeginInvoke() @{Template==null? @Template : No data…
1
2 3
72 73