Two different assembly versions “The located assembly's manifest definition does not match the assembly reference”

前端 未结 5 2332
太阳男子
太阳男子 2020-12-19 20:36

I have a project that I am working on that requires the use of the Mysql Connector for NHibernate, (Mysql.Data.dll). I also want to reference another project (Migrator.NET)

相关标签:
5条回答
  • 2020-12-19 21:06

    You are looking for Assembly Binding Redirection.

    This allows you to configure an application to look for a different assembly version.

    0 讨论(0)
  • 2020-12-19 21:14

    I was also facing the same issue, and was not able to solve by any of the above solution. So finally I found one more solution for this... Remove everything from license.licx file in project=>Properties in solution explorer.

    When I removed everything from this file, its allowing me to build the project successfully

    0 讨论(0)
  • 2020-12-19 21:17

    The simple solution is remove the Mysql.data.dll (that reference to old MySql version) reference from the Migrator.NET project and add new reference MySql.data.dll (the same version used by another project). Build the Migrator.NET again and now all should work fine. I was facing the same issue and the solution I mentioned worked perfectly for me

    0 讨论(0)
  • 2020-12-19 21:18

    In case you have both versions of the assembly one option would be to use them side by side and simply configure the application to look in the right place. You can do this by putting some lines in the app.config, but for me the most reliable way was always to register to the AppDomain.AssemblyResolve event and provide the path for the library that is needed.

    For a simple example you can have a look here (an answer for a not-very related question, but using the same technique ;))

    0 讨论(0)
  • 2020-12-19 21:26

    That's a pretty gross version mismatch. bindingRedirect is not going to help when the versions differ so much. You got it wrong btw, you'd want newVersion to match the one that was found. But don't go there.

    Looking at the Migrator.NET download, I think I see the problem. The lib folder contains a really old version of MySql.Data.dll, it was made to run on .NET 1.0. Start by zapping it and try to rebuild with version 6 of that assembly. Good luck, I think you'll need it.

    0 讨论(0)
提交回复
热议问题