I am trying to use NHiberanate with NDbUnit but I cannot as NDbUnit tried to load MySql.Data version 1.0.10.1 and NHibernate tries to load version 6.2.2.0 and I can only reference one of them.
Here is the error I get when i try to run NDbUnit
Set Up
System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=1.0.10.1, 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)
at NDbUnit.Core.MySqlClient.MySqlDbCommandBuilder.GetConnection(String connectionString)
at NDbUnit.Core.DbCommandBuilder..ctor(String connectionString)
at NDbUnit.Core.MySqlClient.MySqlDbCommandBuilder..ctor(String connectionString)
at NDbUnit.Core.MySqlClient.MySqlDbUnitTest.CreateDbCommandBuilder(String connectionString)
at NDbUnit.Core.NDbUnitTest.GetDbCommandBuilder()
at NDbUnit.Core.NDbUnitTest.ReadXmlSchema(Stream xmlSchema)
at NDbUnit.Core.NDbUnitTest.ReadXmlSchema(String xmlSchemaFile)
at Proteus.Utility.UnitTest.DatabaseUnitTestBase.SaveDatabase(String connectionString, String schemaFilePathName, String datasetFilePathName, DatabaseClientType clientType)
at TGS.UserAccountControlTest.UserAccountManagerTest._TestFixtureSetup() in C:\Documents and Settings\Michal\My Documents\Visual Studio 2008\Projects\TGS\TGS.UserAccountControlTest\UserAccountManagerTest.cs:line 69
Does anyone have any ideas?
If the assembly binding redirect feels either ‘hacky’ (its not at all) or ‘inconveniently brittle’ (it often is), you can also simply recompile NDbUnit against your ‘desired’ MySql.Data assembly (since NDbUnit is open source) by getting the source from http://ndbunit.googlecode.com
To my knowledge (as the primary committer for the NDbUnit project) there are NO breaking changes in the MySql.Data betw. v1x and v6x. The intent of the MySql.Data assembly is merely to provide MySql-specific implementations of the interface ‘family’ that makes up the ADO.NET stack (IDbConnection, IDBCommand, etc.) and so BY DEFINITION there cannot be breaking changes in the MySql.Data assembly from v1 to v6 (since MS hasn’t really TOUCHED these interfaces since .NET 2.0 was released).
The ONLY difference between earlier MySql.Data and later MySql.Data implementations of these interfaces is the verison of MySql that they are intended to support so while the ‘database-facing’ side of this assembly changes over time, the ‘code-facing’ side of the classes contained in this assembly sort of BY DEFINITION cannot have changed from one ver to the next.
Best of luck~!