Having a nightmare of a time setting up a simple Blazor SignalR application.
According to documentation, SignalR is greatly improved in .NET 5. It's not compatible with .NET Core 3.1. That's fair enough.
If I make a Blazor web assembly client, not hosted in .NET Core (I don't understand what that really means but I decided not to check the box to do it), then it runs on .NET Standard 2.1
So if I set up SignalR in .NET 5 and then try to consume it using my .NET Standard 2.1 Blazor client, would that work? If not what should I do?
--
If I make a Blazor web assembly client, not hosted in .NET Core (I don't understand what that really means but I decided not to check the box to do it), then it runs on .NET Standard 2.1
If you create a WASM app using .NET Core 3.1 :
.NET Core hosted: There will be 3 projects created:
.Client
is netstandard2.1
and using Microsoft.NET.Sdk.Web
SDK .Server
will be netcoreapp3.1
and using Microsoft.NET.Sdk.Web
SDK .Shared
will be netstandard2.1
and using Microsoft.NET.Sdk
SDK NOT .NET Core hosted: There will be 1 project created, which is netstandard2.1
and using Microsoft.NET.Sdk.Web
SDK
If you create a WASM app using .NET 5
.NET Core hosted: There will be 3 projects created:
.Client
is net5.0
and using Microsoft.NET.Sdk.BlazorWebAssembly
SDK .Server
is net5.0
and using Microsoft.NET.Sdk.Web
SDK .Shared
is net5.0
and using Microsoft.NET.Sdk
SDK NOT .NET Core hosted: There will be 1 project created, which is net5.0
and using Microsoft.NET.Sdk.BlazorWebAssembly
SDK
So if I set up SignalR in .NET 5 and then try to consume it using my .NET Standard 2.1 Blazor client, would that work? If not what should I do?
This should not be a problem. To avoid any further confusion you can easily upgrade your .NET Core 3.1 WASM app to .NET 5 following these steps:
On .csproj
file:
<Project Sdk="Microsoft.NET.Sdk.Web">
to <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<TargetFramework.netstandard2.1</TargetFramework>
to <TargetFramework.net5.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
Microsoft.AspNetCore.Components.WebAssembly.Build
5.0.0
Make sure you have these setup properly on your machine
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.