Searched SO but can't find a solution that works.
In Visual I've got a main project. It uses another project (ProjectA) that compiles to a DLL. That project uses Servicestack ORMLite 4.5.14. I've also installed
Mysql.Data 6.9.12. ProjectA is reference in the main project by Project, not by compiled DLL.
The compiled application is copied to an other PC (just copy, no install) and started. However, when it tries to access the database using ProjectA I get the following error:
System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=188.8.131.52, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'MySql.Data, Version=184.108.40.206, Culture=neutral, PublicKeyToken=c5687fc88969c44d' ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=220.127.116.11, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'MySql.Data, Version=18.104.22.168, Culture=neutral, PublicKeyToken=c5687fc88969c44d'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
at ServiceStack.OrmLite.MySql.MySqlDialectProvider.CreateConnection(String connectionString, Dictionary`2 options)
at ServiceStack.OrmLite.OrmLiteConnectionFactoryExtensions.Open(IDbConnectionFactory connectionFactory)
at ProjectA.Repositories.ARepository.FindById(String id)
at ProjectA.Controllers.AController.FindById(String id)
at ProjectA.Service.DatabaseService.Find(String id)
What I've tried to solve the issue:
Mysql.Data and ServiceStack ORMlite and reinstall it
mysql.data.dll in the directory so it would be copied back. Checked the version of the DLL and it matches 6.9.12
Mysql.data 8.0 and 6.9.9 but could not find a reference
Since it's using an old Mysql Server an older version of Mysql.Data is needed so also an older version of ServiceStack ORM lite.
I had this problem before, ProjectA is also used in a different project where Mysql 8.0 is needed. Since it's referenced as a project (not a DLL file) this changes back and forth. However, in the past reinstalling
Service Stack ORM lite did solve the issue. But now I'm unable to get past this error. I made sure the versions are the same for all projects in the solution. I'm aware this is bad practice but since we are rewriting the complete application was workable until now.
Any suggestions to solve this issue?
Turns out there was a cache directory in the
obj with an service stack xml file referencing Mysql.Data version 6.9.9. Even after deleting the ServiceStack and Mysql.Data packages using NuGet package manager and reinstalling the correct version, this version number showed up in the ServiceStack xml file in de
debug build directory.
Uninstalling ServiceStack and Mysql.Data packages, deleting the build directories (debug and release), deleting the
obj directory, reinstalling the ServiceStack and Mysql.Data packages solved the problem.
Thanks for the answers @jdwang and @user9938.
User contributions licensed under CC BY-SA 3.0