0
votes

I made a C# project, and could Fluently configure for SQLite without even adding a reference to System.Data.SQLite.dll. Now when attempting a VB.NET project, with or without the reference, I get a

FileNotFoundException: Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. The system cannot find the file specified.

Is it NHibernate or FluentNHibernate looking for this dll (?) And how come they don't look in the references? Or what am I missing..?

Btw, there is someting called "FusionLog", which says:

=== Pre-bind state information ===
LOG: User = PC\windowslogin
LOG: DisplayName = System.Data.SQLite
 (Partial)
LOG: Appbase = file:///(Project folder)./bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: (project folder/name).vshost.exe.Config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
1

1 Answers

0
votes

Check the bin folder of your C# projects, the DLL may have found its way in there. If it has delete it, and it will either have the same error, or it will copy it into there when you build. If it's the latter, it realizing the dependency and copying the file in.

The error above occurs when the dll is not found either in one of the search paths, or the GAC. The search paths includes the bin folder (first) and some other system folders.

To solve the VB issue, reference the SQLite assembly and make sure you have "CopyLocal" on. Unless you have this, VS will not copy the assembly to the out path as you are not explicitly referencing it. NHibernate would be dynamically loading that assembly.