Răzvan Flavius Panda
Răzvan Flavius Panda

Reputation: 22126

Upgrading SignalR

In the following solution link SignalR is installed version 1.0.1

SignalR does not appear in the list of NuGet packages so I don't know how to upgrade it. It appears under SDK -> Microsoft.AspNetCore.App (2.1.1) so it is installed as a dependency of that.

I tried upgrading it by installing latest SignalR using NuGet but the code does not pick up the latest version. I know this because when I control click a SignalR type it opens a new file where it says it is using: Assembly location: C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.signalr.core\1.0.1\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Core.dll

How to upgrade SignalR in this scenario?

Upvotes: 0

Views: 1677

Answers (2)

zivkan
zivkan

Reputation: 15082

ASP.NET Core SignalR is a component of ASP.NET Core, so you don't upgrade it separately. ASP.NET Core is bundled in the hosting platform. Therefore, to upgrade ASP.NET Core SignalR (or ASP.NET Core), you download a newer .NET SDK and build/run your app with the newer runtime (change global.json's sdk section, if you have one, otherwise it normally uses the latest by default. Use dotnet --info to check).

You said that your app is currently using v2.1.1 of Microsoft.AspNetCore.App, which tells me you're running .NET Core 2.1. On https://dotnet.microsoft.com/download the latest version of .NET Core is 2.2, so there is an update available, although I have no idea what changes to SignalR it will include.

edit: The page you linked with the two versions of SignalR clearly state the name of the NuGet packages, but also show you that Microsoft.AspNet.SignalR works with the ASP.NET (System.Web) and OWIN servers, while Microsoft.AspNetCore.SignalR works with the ASP.NET Core server. Since your app is using Microsoft.AspNetCore.App, you don't have a choice about which version of SignalR to use. If you want to use the other one, you have to create a new project that uses either the .NET Framework ASP.NET (that uses System.Web), or uses the OWIN libraries.

As for the Microsoft.AspNetCore.SignalR NuGet package, if you look at the dependencies, you'll see that it depends on things that are part of ASP.NET Core 2.2, and therefore incompatible with your ASP.NET Core 2.1 app. You can try to add a reference to the newest SignalR package, but when I tried, when I restored the project I got these error messages:

C:\git\test\aspnetcoretest\aspnetcoretest.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.AspNetCore.App 2.1.1 requires Microsoft.AspNetCore.SignalR (>= 1.0.1 && < 1.1.0) but version Microsoft.AspNetCore.SignalR 1.1.0 was resolved.

C:\git\test\aspnetcoretest\aspnetcoretest.csproj : error NU1107: Version conflict detected for Microsoft.AspNetCore.Authentication.Abstractions. Install/reference Microsoft.AspNetCore.Authentication.Abstractions 2.2.0 directly to project aspnetcoretest to resolve this issue.

C:\git\test\aspnetcoretest\aspnetcoretest.csproj : error NU1107: aspnetcoretest -> Microsoft.AspNetCore.SignalR 1.1.0 -> Microsoft.AspNetCore.Http.Connections 1.1.0 -> Microsoft.AspNetCore.Authorization.Policy 2.2.0 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0)

C:\git\test\aspnetcoretest\aspnetcoretest.csproj : error NU1107: aspnetcoretest -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.1.1 && < 2.2.0).

Restore failed in 964.82 ms for C:\git\test\aspnetcoretest\aspnetcoretest.csproj.

So, as I said in the first sentence of the first paragraph, you don't upgrade it separately. If you want to use the newer SignalR, you edit your csproj and change <TargetFramework>netcoreapp2.1</TargetFramework> to <TargetFramework>netcoreapp2.2</TargetFramework>. You need to install .NET Core 2.2 SDK if you haven't already.

Upvotes: 1

George Grainger
George Grainger

Reputation: 172

Try deleting the the signalR .dll files from the NugetFallbackFolder, I would then expect it to look for the relevant .dll files in the non-fallback folder

Upvotes: 0

Related Questions