Ive recently come back to an old .Net Core application which was using SignalR.
I think at the time the only SignalR NuGet package available for .Net Core applications was a preview. And it worked.
Im now on a new machine and dont know what the preview feed was for this package so ive uninstalled it and installed this:
> Install-Package Microsoft.AspNet.SignalR.Core -Version 2.4.1
Everything seems fine with a few namespace changes apart from these two errors in the Startup.cs file.
Error CS1061 'IServiceCollection' does not contain a definition for 'AddSignalR' and no accessible extension method 'AddSignalR' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
Error CS1061 'IApplicationBuilder' does not contain a definition for 'UseSignalR' and no accessible extension method 'UseSignalR' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)
I've looked around and there isn't much available for me, other than someone suggesting you need to install Microsoft.AspNetCore.SignalR.Http
which I cant find. Someone else suggested you need to install this:
Install-Package Microsoft.AspNetCore.SignalR.Client -Version 1.1.0
Which I've tried, but the errors remain, how do I get these to go away?
Microsoft.AspNetCore.SignalR
is part of ASP.NET Core since 2.1.
So if you set the target version to NET Core 2.1 or higher under Project->Properties->Target framework in Visual Studio, you should be able to call services.AddSignalR()
in your ConfigureServices
method.