Azure / azure-signalr

Azure SignalR Service SDK for .NET

Home Page:https://aka.ms/signalr-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop Microsoft.Azure.SignalR.Management including a FrameworkReference for Microsoft.AspNetCore.App

a-teece opened this issue · comments

Is your feature request related to a problem? Please describe.

The Microsoft.Azure.SignalR.Management includes a FrameworkReference for Microsoft.AspNetCore.App even though a common use-case would be to broadcast messages from a service application; which is even called out in the project readme.

This causes apps targetting the Microsoft.Windows.SDK.NET.Ref framework to require the AspNet Core runtime to be deployed on the host to function.

When referencing the package from .Net Framework 4.7.2 all the dependencies are deployed.
When referencing the package from .net 8.0 any dependency that is included with the Asp Net Core runtime is excluded.

Describe the solution you'd like

Microsoft.Azure.SignalR.Management should only have a framework dependency of Microsoft.NETCore.App and should avoid references to AspNet to support basic functions regarding broadcasting messages, checking connected users, etc.

Additional context

Add any other context or screenshots about the feature request here.

commented

Microsoft.Azure.SignalR.Management heavily relies on some interfaces provided by Microsoft.AspNetCore.App such as IHubContext, therefore, we cannot remove the reference to Microsoft.AspNetCore.App.

My understanding is that you don't have to reference the framework, you can refernce the individual NuGet packages for the components you need.

By not demanding the framework and instead referencing the NuGet packages directly the consumers of Microsoft.Azure.SignalR.Management hosting in a Microsoft.AspNetCore.App project will automatically ignore the NuGet packages. Customers hosting in a WindowsDesktop app (or other) will continue to reference the NuGet packages and the deployment will work.

The problem that exists today is that if I add the NuGet to a Microsoft.AspNetCore.App project everything works. It is reasonably expected that the AspNetCore runtime is required on the host.

If I add the NuGet to any other framework project everything runs on a developer machine and compiles, but when it is deployed to a host you get strange errors about not being able to find an assembly and it is not immediately obvious that you must deploy the AspNetCore runtime for a Windows Service or Console app.

I think it worth point out that if you add the NuGet to a .Net Framework 4.7.2 project that it does reference the AspNetCore NuGet packages and it does include them in the build output and it does all work on a host that does not have the AspNetCore runtime deployed.

commented

Since .NET Core 3.1, SignalR doesn't have a server nuget package anymore. Included in the Microsoft.AspNetCore.App shared framework. See https://learn.microsoft.com/en-us/aspnet/core/signalr/version-differences?view=aspnetcore-8.0#how-to-identify-the-signalr-version