NuGet version coflict with SignalR and Owin

2

I’m trying to setup up a selfhosted SignalR & WebAPI project with owin, following this ( https://www.youtube.com/watch?v=2prTfk0n9x0 ) but I quickly ran into issues. My project creates a class library which is loaded by my main application.

As shown in the video I've installed three NuGet Packages:

  • Microsoft.AspNet.SignalR.SelfHost
  • Microsoft.AspNet.WebApi.OwinSelfHost
  • Microsoft.Owin.Cors

While loading my library an exception occurs telling me, that the package Microsoft.AspNet.SignalR.Core (2.4.1.0) tries to load Microsoft.Owin Version 2.1.0.0 but it found a differed version (4.0.1).

I've added:

    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
    </dependentAssembly>

To both app.config files, the one of my library project and the one of my main application but with no effect. I'm not very familiar with nuget so I ran out of ideas how to solve this problem.

This is the full (german) Exception text + additional information:

    Die Datei oder Assembly \"Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)

    === Zustandsinformationen vor Bindung ===
    LOG: DisplayName = Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\n (Fully-specified)
    LOG: Appbase = file:///C:/projects/MyApp/bin/Debug/
    LOG: Ursprünglicher PrivatePath = NULL
    Aufruf von Assembly : Microsoft.AspNet.SignalR.Core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
    ===
    LOG: Diese Bindung startet im default-Load-Kontext.
    LOG: Die Anwendungskonfigurationsdatei wird verwendet: C:\\projects\\MyApp\\bin\\Debug\\MyApp.exe.Config
    LOG: Die Hostkonfigurationsdatei wird verwendet: 
    LOG: Die Computerkonfigurationsdatei von C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\config\\machine.config wird verwendet.
    LOG: Verweis nach der Richtlinie: Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    LOG: Download von neuem URL file:///C:/projects/MyApp/bin/Debug/Microsoft.Owin.DLL.
    WRN: Der Vergleich des Assemblynamens führte zum Konflikt: Hauptversion.
    ERR: Das Setup der Assembly konnte nicht abgeschlossen werden (hr = 0x80131040). Die Suche wurde beendet.

/Edit as result of Matěj Štágl's answer:

I forgot to mention, that I tried to downgrade already, but it just forced me do downgrade more and more, because all dependencies must be downgraded, too.

I just did it again to give an idea of it:

  • Downgraded to Microsoft.Owin 2.1.0 makes Microsoft.AspNet.SignalR.Core to require Microsoft.Owin 2.0.2.0.
  • This downgade forces also one of Microsoft.AspNet.SignalR.Core the new Version requires Microsoft.Owin 2.0.1.0.
  • A new downgrade makes System.Web.Http to require System.Net.Http.Formatting in version 5.0.0.0.
  • A downgrade of Microsoft.AspNet.WebApi.Client makes System.Net.Http.Formatting ask for Newtonsoft.Json in version 4.5.0.0. This version is not offered by NuGet and Microsoft.AspNet.SignalR.Core want’s version 4.5.11 of Newtonsoft.Json at the same time.
c#
nuget
signalr
owin
asked on Stack Overflow Sep 3, 2019 by copper spinner • edited Sep 4, 2019 by copper spinner

1 Answer

1

Simple solution would be to install the version of owin SignalR calls for. Open nuget packages manager, select installed tab, select Microsoft.Owin and in the right panel, under version dropdown select 2.1:

enter image description here

Alternatively you can do the same via Package Manager Console:

Install-Package Microsoft.Owin -Version 2.1.0.0
answered on Stack Overflow Sep 3, 2019 by Matěj Štágl

User contributions licensed under CC BY-SA 3.0