I am using NHibernate against an Oracle database with the NHibernate.Driver.OracleDataClientDriver driver class. I have an integration test that pulls back expected data properly when executed through the IDE using TestDriven.net. However, when I run the unit test through the NUnit GUI or Console, NHibernate throws an exception saying it cannot find the Oracle.DataAccess assembly. Obviously, this prevents me from running my integration tests as part of my CI process.
NHibernate.HibernateException : The
IDbCommand and IDbConnection
implementation in the assembly
Oracle.DataAccess could not be found.
Ensure that the assembly
Oracle.DataAccess is located in the
application directory or in the Global
Assembly Cache. If the assembly is in
the GAC, use
element in the application
configuration file to specify the full
name of the assembly.*
I have tried making the assembly available in two ways, by copying it into the bin\debug folder and by adding the element in the config file. Again, both methods work when executing through TestDriven in the IDE. Neither work when executing through NUnit GUI/Console.
The NUnit Gui log displays the following message.
21:42:26,377 ERROR [TestRunnerThread]
ReflectHelper [(null)]- Could not load
type
Oracle.DataAccess.Client.OracleConnection,
Oracle.DataAccess.
System.BadImageFormatException: Could
not load file or assembly
'Oracle.DataAccess,
Version=2.111.7.20, Culture=neutral,
PublicKeyToken=89b483f429c47342' or
one of its dependencies. An attempt
was made to load a program with an
incorrect format.
File name: 'Oracle.DataAccess,
Version=2.111.7.20, Culture=neutral,
PublicKeyToken=89b483f429c47342' ---
System.BadImageFormatException: Could
not load file or assembly
'Oracle.DataAccess' or one of its
dependencies. An attempt was made to
load a program with an incorrect
format.
File name: 'Oracle.DataAccess'
I am running NUnit 2.4.8, TestDriven.net 2.24 and VS2008sp1 on Windows 7 64bit. Oracle Data Provider v2.111.7.20, NHibernate v2.1.0.4.
Has anyone run into this issue, better yet, fixed it?