Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use Microsoft.AspNet.SignalR.Client with .NET Core (dnxcore)

This could be a simple No if it's not possible, so first I'll ask outright, Is it possible to use Microsoft.AspNet.SignalR.Client with dnxcore50 right now?

If it should be possible, details of the error I'm hitting are below, this a vNext Console Application:

After adding a dependency on Microsoft.AspNet.SignalR.Client version 2.2.0 the code compiles correctly for dnx451, however for dnxcore50, I am getting an error that I can't seem to figure out:

var hubConnection = new HubConnection("http://localhost");
IHubProxy hubProxy = hubConnection.CreateHubProxy("MyHubName");

Visual Studio underlines the CreateHubProxy() method with the error:

The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'

Obviously as I want to use dnxcore50 I can't just add a reference to mscorlib. I'm trying to figure out if there's something under System that I should referencing here or if this package is just not compatible.

like image 683
Dan Harris Avatar asked Oct 18 '22 11:10

Dan Harris


1 Answers

I've found out that at the moment, there's no (reasonably simple) way to get this running on dnxcore50.

I asked Scott Hanselman on Twitter too and he confirmed that you can't right now.

With this I will continue to use the vNext Console Application project so that when the SignalR Client Libraries offer support it should be the case of a config change and package update to run this on both Linux and Mac using .NET Core

like image 72
Dan Harris Avatar answered Oct 30 '22 03:10

Dan Harris