How to resolve .NET Core reference and NuGet package version conflicts When using Dapper library in Hangfire project?

1

When using Hangfire library into .net core application, There is a version conflict occured between two different Dapper library. One version is V1.5.0 from Nuget package, and another version is V1.0.0 reference from my local .net core project. There is an error when running program.

 System.IO.FileLoadException
  HResult=0x80131040
  Message=Could not load file or assembly 'Dapper, Version=1.50.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=Hangfire.SqlServer
  StackTrace:
   at Hangfire.SqlServer.SqlServerObjectsInstaller.Install(DbConnection connection, String schema)
   at Hangfire.SqlServer.SqlServerStorage.<>c__DisplayClass24_0.<UseConnection>b__0(DbConnection connection)
   at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func`2 func)
   at Hangfire.SqlServer.SqlServerStorage.UseConnection(DbConnection dedicatedConnection, Action`1 action)
   at Hangfire.SqlServer.SqlServerStorage.Initialize()
   at Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration configuration, String nameOrConnectionString)

Unfortunately, I have to keep the old version library rather to replcace it. How can I resolve the package version conflict meanwhile two library exist together. Hope someone can find a nice solution. Thanks!

.net-core
nuget
dapper
hangfire
asked on Stack Overflow Jan 17, 2019 by Bes Ley • edited Jan 21, 2019 by Bes Ley

1 Answer

1

Uninstall Dapper in Nuget and install the version that it is looking for, in my case 1.50.1.0. Not sure why Hangfire is coded to a specific version, but this solves the issue.

Hopefully this is a not a permanent bug on their end, but this will work until it is fixed.

answered on Stack Overflow Feb 11, 2019 by WillC

User contributions licensed under CC BY-SA 3.0