0
votes

Recently I tried to import SignalR dlls into a Unity project (support for .NET Standard 2.0). The NuGet package -> Microsoft.AspNetCore.SignalR.Client is currently at version 3.1.2. Here are the dependencies listed:

.NETStandard,Version=v2.0

Microsoft.AspNetCore.Http.Connections.Client

(>= 3.1.2) Microsoft.AspNetCore.SignalR.Client.Core (>= 3.1.2)

However, when I move these dlls into the Unity project, I'm greeted with an error:

Error CS1705 Assembly 'Microsoft.AspNetCore.SignalR.Client.Core' with identity 'Microsoft.AspNetCore.SignalR.Client.Core, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' uses 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' which has a higher version than referenced assembly 'netstandard' with identity 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

That makes sense to me, as I don't expect Unity to support Version 2.1 (the table at the .NET Standard docs states that 2.0 is the latest for Unity. I'm able to downgrade the package to Version 1.1, and everything works as expected (at least this error disappears). I determined which version of SignalR.Client to choose by going through each version, installing/copying until the errors disappeared.

The dependencies for 1.1.0 are identical (exception the Core and Client packages are now listed as (>=1.1.0) instead of (>= 3.1.2).

Question: Is there a "better" way than guess-and-check to figure out which version of .NET Standard is required, maybe a spec somewhere that shows which version of .NET Standard needs to be supported for a package to be used?

1
Microsoft.AspNetCore.SignalR.Client.Core supports netstandard2.0. Curious that it's resolving to the dll that targets netstandard2.1 for you.mason
I've been a .NET developer for 10 years, but I've only touched Unity a handful of times. What IDE are you using? Is there a project file or something else you can edit to point it towards the proper DLL? The DLL is inside the NuGet package at /lib/netstandard2.0/Microsoft.AspNetCore.SignalR.Client.Core.dllmason
Unity looks for external dlls in the plugins folder, so I've been manually placing them there (essentially building a regular project that uses signalr and grabbing the dll and all required assemblies and dumping them into unity). I guess at some point VS2019 felt that it could grab the dll that supports the latest standard for the Client.Core dependency, even though Client uses .net standard 2.0. I assume that I can control this by target a diff version of .net core, I will have to check that to see if it resolves the issue.Kolichikov

1 Answers

0
votes

Yes, there is an easy way.

FuGet lists many details about NuGet packages, including which versions of which frameworks are targeted. For example, Microsoft.AspNetCore.SignalR.Client 3.1.2 targets netstandard2.0.

A handy shortcut is you're looking at the NuGet page for a package, you can easily get to the Fuget page by just replaying "nuget" in the URL bar with "fuget".