3

In my project with .net 8 SignalR is used for data streaming using websockets.

Some time ago I created a prototype of solution using the package Microsoft.AspNetCore.SignalR. However this is announced as deprecated. In my code I was using etc. hubs, which are part of the mentioned package. Alternatively hubs are also available in Microsoft.AspNet.SignalR.Core, which is maintained but it targets older .net versions and I think it does not provide the same functionality, although things are called in very similar way.

My concern is to use the deprecated package in new project also due to potential vulnerabilities.

This rather a bit older post suggests to reference Microsoft.AspNetCore.App, because it includes the functionalities of deprecated SignalR package, but the Microsoft.AspNetCore.App is deprecated itself.

What I seek is the solution which library should I use, to reference a maintained package in my project in order to keep the functioanlity with hubs and low latency web socket communication. I am rather not experienced developer so I appreciate feedback on this or info if my concern is real or what I missed in my understanding.

Thank you!

3
  • 1
    You don't need any NuGet package, server-side SignalR is part of ASP.NET Core itself since .NET Core 3. If you look at the official docs, eg the Quickstart tutorial you'll see no package needs to be added. Are you trying to migrate from an old ASP.NET Core version to ASP.NET Core 8? Commented Oct 10, 2024 at 7:45
  • 1
    If you check the Hub class docs you'll see the "Package" is Microsoft.AspNetCore.App.Ref, ie ASP.NET Core itself. You'll have to change the ASP.NET Core version all the way back to ASP.NET Core 2.2 to see Microsoft.AspNetCore.SignalR.Core Commented Oct 10, 2024 at 7:47
  • People write and accept their own answers to close a discussion. You should do that too. Commented Nov 12, 2024 at 0:27

1 Answer 1

3

EDIT (from author of the question maciejw):

I know already what my mistake/misunderstanding was, I got explanation in the recension process from one of the:

If you look closely at the post you linked to, it's using a FrameworkReference not a PackageReference. Microsoft.AspNetCore.App as a framework is not deprecated. You also only need the framework reference if you're making a library, if you're making an application then the web sdk (top of your csproj) will include the framework reference automatically. learn.microsoft.com/aspnet/core/fundamentals/… has more info.

So the solution is, when creating project of type .net library (in my case .net 8) in .csproj file put:

<ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

That solves the problem. Thank you for your help!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.