blazor-server-side

Blazor Server - static files don't link in non-DEV environments

末鹿安然 提交于 2019-12-10 10:38:48
问题 It seems in a standard Blazor server app, the _content folder items are not being referenced correctly for anything other than the Development environment. As an example, this reference fails in any non-dev environment: from _Host.cshtml: <link href="_content/Blazored.Typeahead/blazored-typeahead.css" rel="stylesheet" /> To Repro, using Blazored-toast lib as an example (but any static file refs seem to have this issue): Create a new Blazor Server project (dotnet new blazorserver) Add all

How can I deploy a Blazor server-hosted application from Visual Studio 2019

眉间皱痕 提交于 2019-12-10 09:51:16
问题 I am using VS2019 Preview. I have created a "server-hosted" Blazor application using the latest Blazor extension (16.0.19227). This is the variant that contains 3 separate projects... MyApp.Client MyApp.Server MyApp.Shared I can debug this by making MyApp. Server the active project and all works fine but I'm struggling to publish/deploy this to Azure. I have tried the following... Right-click on MyApp.Server in Solution-Explorer Choose "Publish" Go through the wizard to create a new publish

Display a timer in Blazor

被刻印的时光 ゝ 提交于 2019-12-08 01:02:13
问题 I am attempting to display a countdown timer in a server-side Blazor app. My code is in both F# and C#. The code somewhat works, but the timer never stops as intended, and the timer display sporadically does not render all of the numbers. This is my first attempt at a Blazor server-side app. I am not sure if the problem is an async issue, timer issue, or rendering issue. Here's my code: F# let private setTimer countDown timeEvent = let timer = new Timer(float countDown * float 1000) let

How to Separate Code From UI In Blazor.Net

心已入冬 提交于 2019-12-07 23:08:51
问题 Reference to this VisualStudioMagazine article, I am trying to have code in a separate file instead of razor view. I tried: @page "/Item" @using WebApplication1.Shared @using WebApplication1.Client.Services; @inject HttpClient Http @inherits ItemComponent @if (ItemList != null) { <table class="table"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Category</th> <th>Metal</th> <th>Price</th> <th>Quantity</th> </tr> </thead> <tbody> @foreach (var item in ItemList) { <tr> <td>@item.ID</td> <td>@item

Blazor Textfield Oninput User Typing Delay

家住魔仙堡 提交于 2019-12-07 03:16:45
问题 How can I add a delay to an event (OnInput) in Blazor ? For example, if a user is typing in the text field and you want to wait until the user has finished typing. Blazor.Templates::3.0.0-preview8.19405.7 Code: @page "/" <input type="text" @bind="Data" @oninput="OnInputHandler"/> <p>@Data</p> @code { public string Data { get; set; } public void OnInputHandler(UIChangeEventArgs e) { Data = e.Value.ToString(); } } 回答1: Solution: There is no single solution to your question. The following code

How to turn on CircuitOptions.DetailedErrors?

∥☆過路亽.° 提交于 2019-12-06 18:18:05
问题 I'm getting this message in the console when running a server-side Blazor app: Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions in 'CircuitOptions.DetailedErrors' I've had a look at the Blazor error handling documentation, but I can't work out how to actually turn on the detailed errors mentioned in that message? 回答1: More digging on this revealed that there are both non-Blazor specific .NET Core

How to Separate Code From UI In Blazor.Net

我怕爱的太早我们不能终老 提交于 2019-12-06 05:48:37
Reference to this VisualStudioMagazine article, I am trying to have code in a separate file instead of razor view. I tried: @page "/Item" @using WebApplication1.Shared @using WebApplication1.Client.Services; @inject HttpClient Http @inherits ItemComponent @if (ItemList != null) { <table class="table"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Category</th> <th>Metal</th> <th>Price</th> <th>Quantity</th> </tr> </thead> <tbody> @foreach (var item in ItemList) { <tr> <td>@item.ID</td> <td>@item.Name</td> <td>@item.Category</td> <td>@item.Metal</td> <td>@item.Price</td> <td>@item.Quantity</td> <

The “TransformAppSettings” task failed unexpectedly

陌路散爱 提交于 2019-12-06 05:13:40
问题 I have a .NET Core 3 Blazor (server side) application which I recently upgraded to .NET Core 3.0.1 preview 6 version from the preview 5 version. When I build and run it locally, it works fine; but when trying to publish it to a file system folder (in Framework-Dependent mode), it throws this error: C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\Sdks\Microsoft.NET.Sdk.Publish\targets\TransformTargets\Microsoft.NET.Sdk.Publish.TransformFiles.targets(192,5): Error MSB4018: The

Blazor Server - static files don't link in non-DEV environments

自古美人都是妖i 提交于 2019-12-06 04:38:46
It seems in a standard Blazor server app, the _content folder items are not being referenced correctly for anything other than the Development environment. As an example, this reference fails in any non-dev environment: from _Host.cshtml: <link href="_content/Blazored.Typeahead/blazored-typeahead.css" rel="stylesheet" /> To Repro, using Blazored-toast lib as an example (but any static file refs seem to have this issue): Create a new Blazor Server project (dotnet new blazorserver) Add all necessary Blazored / Toast elements, including code to demo a toast message Test that toast is working

How can I deploy a Blazor server-hosted application from Visual Studio 2019

天涯浪子 提交于 2019-12-05 19:37:26
I am using VS2019 Preview. I have created a "server-hosted" Blazor application using the latest Blazor extension (16.0.19227). This is the variant that contains 3 separate projects... MyApp.Client MyApp.Server MyApp.Shared I can debug this by making MyApp. Server the active project and all works fine but I'm struggling to publish/deploy this to Azure. I have tried the following... Right-click on MyApp.Server in Solution-Explorer Choose "Publish" Go through the wizard to create a new publish profile Change the deployment mode to "self-contained" Hit publish At this point I get an error during