This is basically a copy of this question but the repository has been archived so I can't ask it there: https://github.com/aspnet/SignalR/issues/1645
I am trying to get an older application running .NET Framework to connect to a newer application running .NET Core using SignalR. I've read some posts that say that the AspNetCore & AspNet versions of SignalR are incompatible, so the goal is to get a Microsoft.AspNetCore.SignalR.Client running on the .NET Framework application.
I've made a test project using framework version 4.6.1, which I believe is .NET Standard 2.0 so I should be able to install this package https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client/1.0.0-preview1-final according to a comment by davidfowl I'm unable to install this package on my 4.6.1 project so I must be doing something wrong.
I also tried another workaround which was creating a netstandard2.0 library using the Microsoft.AspNetCore.SignalR.Client v3.1.6 code, and then referencing the .dll from my 4.6.1 project.
The 3.1.6 code in my netstandard2.0 library looks like this:
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Concurrent;
public class SignalRConnection
{
private readonly HubConnection hubConnection;
public SignalRConnection(string endpoint)
{
this.endpoint = endpoint;
hubConnection = new HubConnectionBuilder()
.WithUrl(endpoint)
.Build();
}
}
I've referenced this by going to references in my 4.6.1 project, right clicking and pressing add reference and selecting my netstandard2.0 project. The 4.6.1 code that I am calling this with is:
class Program
{
static void Main(string[] args)
{
SignalRConnection connection = new SignalRConnection("http://localhost:8080/status");
}
}
I thought this might be because I'm not using 1.0.0, so I also tried with that version. I get the same exception FileNotFoundException but for each different version.
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.AspNetCore.SignalR.Client.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'
Has anyone had any luck connecting a .NET Framework app to a .NET Core app using SignalR and could give me some pointers on where I've went wrong? Thank you
Edit:
I was able to get this to install in a 4.6.1 project using VS 2019, but when I tried to install it into a 4.6.1 project in VS 2015 it gave me the above error
Microsoft.AspNetCore.SignalR.Client
does not include an assembly for your project. There's a major design flaw in NuGet right now where it won't block you (or even warn you!) when you install a package that doesn't add any assembly-reference dependencies to the target project. – Dai