blazor-client-side

Recompile .razor files on save for Blazor WASM

旧街凉风 提交于 2021-01-27 18:40:28
问题 Is there a way to make Blazor Webassembly recompile .razor files when they're changed/updated and then saved? I'm used to this happening both in traditional ASP.NET Core MVC razor views as well as client-side frameworks like Angular. In ASP.NET Core MVC >3.0, something like services.AddRazorPages().AddRazorRuntimeCompilation(); would do the trick, but nothing exists for Blazor that I could find. It's annoying when I need to stop the entire application and restart it to see the latest changes.

Reading static files in ASP.NET Blazor

一曲冷凌霜 提交于 2021-01-27 12:21:53
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

Reading static files in ASP.NET Blazor

拥有回忆 提交于 2021-01-27 12:21:02
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

Blazor [WASM] System.TypeLoadException: Could not resolve type with token 0100001a

北慕城南 提交于 2021-01-27 07:22:32
问题 I'm getting this error: enter code here System.TypeLoadException: Could not resolve type with token 0100001a from typeref (expected class 'System.Threading.Tasks.Task' in assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') When I switch to: <TargetFramework>netcoreapp3.1</TargetFramework> or <TargetFramework>netcoreapp5.0</TargetFramework> from netstandard2.1 My packages are: <PackageReference Include="Blazored.LocalStorage" Version="2.1.5" />

How to render a Blazor component into an HTML string

天大地大妈咪最大 提交于 2021-01-22 00:31:33
问题 I'm looking for a way to render a Blazor component into an HTML string, so that I'll be able to use it as a templating engine to create and send emails in my web application. Ideas? 回答1: Yes, you can use the test library provided by Steve Sanderson and adapt it to your needs. This article explains how to use it : Introduction to Blazor Component Testing . The library can be use to generate the HTML of a component. exemple : var host = new TestHost(); var component = host.AddComponent

How to use both Blazor client and server in same web

喜你入骨 提交于 2021-01-20 08:14:39
问题 I'm learning about the Blazor , and see benefit of 2 types client-side and server-side . I want to use both on the same web e.g. one path is a client-side WebAssembly app, another path is a server-side that run code in server. I have seen Blazor Full-Stack template (not quite understand) but it missing from latest templates package. Did they remove it on purpose? (only 2 left Blazor Server App and Blazor WebAssembly App ) I download templates from this command. dotnet new -i Microsoft

Blazor Webassembly Authenticated Event

心已入冬 提交于 2021-01-04 04:28:06
问题 When authenticating users with Microsoft.AspNetCore.Components.WebAssembly.Authentication, in a Blazor Webassembly application on the client side app that is hosted on ASP.NET Core (latest, blazor), when/how to call an action every time a user is authenticated? Even if they come back to the app and have an active session. Update 2020-07-15: The problem I am trying to overcome is that we have a service that goes to Graph API once a user logs in (MSAL) to get their info and profile image. After

Blazor Webassembly Authenticated Event

余生颓废 提交于 2021-01-04 04:27:39
问题 When authenticating users with Microsoft.AspNetCore.Components.WebAssembly.Authentication, in a Blazor Webassembly application on the client side app that is hosted on ASP.NET Core (latest, blazor), when/how to call an action every time a user is authenticated? Even if they come back to the app and have an active session. Update 2020-07-15: The problem I am trying to overcome is that we have a service that goes to Graph API once a user logs in (MSAL) to get their info and profile image. After

Blazor Webassembly Authenticated Event

戏子无情 提交于 2021-01-04 04:27:38
问题 When authenticating users with Microsoft.AspNetCore.Components.WebAssembly.Authentication, in a Blazor Webassembly application on the client side app that is hosted on ASP.NET Core (latest, blazor), when/how to call an action every time a user is authenticated? Even if they come back to the app and have an active session. Update 2020-07-15: The problem I am trying to overcome is that we have a service that goes to Graph API once a user logs in (MSAL) to get their info and profile image. After

Blazor Webassembly Authenticated Event

眉间皱痕 提交于 2021-01-04 04:27:09
问题 When authenticating users with Microsoft.AspNetCore.Components.WebAssembly.Authentication, in a Blazor Webassembly application on the client side app that is hosted on ASP.NET Core (latest, blazor), when/how to call an action every time a user is authenticated? Even if they come back to the app and have an active session. Update 2020-07-15: The problem I am trying to overcome is that we have a service that goes to Graph API once a user logs in (MSAL) to get their info and profile image. After