1
votes

I use mspec for my tests and have a NHiernate Setup using SQLite x86 for my database in the tests. The problem is that when i run my test using the mspec r# runner everything works fine but running it from the console thwors an error that it cannot find the sqlite dll.

My config of the specification projects:

.net 4

x86 (using the x86 version of sqlite)

System.Data.SQLite, Version=1.0.64.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139 mspec, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null, target runtime: v4.0.30319, target: x86

MSpec is built from source. In Reflector the mspec.exe shows up as built for x86 - which seems right for my setup and as said tests are running fine using r# runner.

NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite 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. at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName) at NHibernate.Driver.SQLite20Driver..ctor()

Has anyone an idea how to fix that?

thanks in advance and greetings from cloudy vienna,

Chris

1
Post the exact exception message. Use fuslogvw.exe to solve assembly resolution problems.Hans Passant
here is the relevant part from the stack traceChristian Hubinger

1 Answers

7
votes

Using fuslogvw.exe i found the accutal error (thanks for the hint ;): "Rejecting IJW module built against v2.0.50727 because it could be loaded into another runtime in this process."

Adding a mspec.exe.config like:

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true" ></startup>
</configuration>

solved the issue, now my test runas expected.

thanks & greetings,

chris