views:

872

answers:

3

UPDATE

In the last update I could use SQLite for unit testing but not in an application run. That problem has now been resolved by modifying config to allow [loading from a remote assembly](http://msdn.microsoft.com/en-us/library/dd409252(VS.100.aspx)

<runtime>
    <loadFromRemoteSources enabled="true"/>
</runtime>

in addition to enabling mixed mode loading (see Mauricio's answer below), using the latest SQLite dll here at Source Forge, and cleaning out the GAC from a previous install of SQLite

Cheers,
Berryl

+3  A: 
  1. Sure. You can also use previous versions if you configure mixed mode loading.
  2. No need to be in the GAC. You can use gacutil to remove the assemblies from the GAC.
  3. Use the x64 DLL to target Windows x64 and x86 for Windows x86
  4. Please post the full exception stack trace. Also if you're using a 3.5 assembly use mixed mode loading.
  5. FNH has no reference to SQLite.
Mauricio Scheffer
Hi Mauricio. Awesome info so far, if not a fix yet. Tacked the stack trace at end of my post. When I changed the build to x64 from ANY CPU I got a loader exception. What a pain!!
Berryl
I switched dll and build to x86 versions again. Now I've got " ----> System.Resources.MissingManifestResourceException : Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "System.Data.SQLite.SR.resources" was correctly embedded or linked into assembly "System.Data.SQLite" at compile time, or that all the satellite assemblies required are loadable and fully signed."
Berryl
@Berryl, the SQLite dll from phxsoftware isn't built for AnyCPU since it contains an unmanaged dll. You need to change references, or edit the project file manually to add the conditional references.
Lasse V. Karlsen
@Lasse, I currently am using the x86 dll (with build setting on x86), and am still having the "can't create SQLite20Driver" error. Interestingly though, the latest v1.066 (I've posted the source forge link above) appears to be all managed. Thanks for the reply.
Berryl
A: 

I installed from http://sqlite.phxsoftware.com/ -> SourceForge...

Basically, I am having the same issue.

I am getting this: Tests.Northwind.Data.StaffMemberRepositoryTests.CanLoadStaffMembersMatchingFilter: FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

  • Database was not configured through Database method.

    ----> NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.SQLite20Driver. ----> 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.

Tom
I just dropped System.Data.SqLite.dll right into MyApp.Tests\bin\debug and it worked.
Tom
Sadly but truly, this works the best for me too. And only with the x86 dll and target. Fragile, at least from a source control pov and probably more, but at least it works. Cheers
Berryl
A: 

I want this to stand out so it will help someone else; the full reason this happens is explained here; so adjust your congig to use BOTH the redirect there in combo with the mixed loading mode referenced here by Mauricio.

Berryl