SQLite and .NET UserControl

I decided to use SQLite for a small project. However, I ran into a problem. SQLite comes with two different DLL files. I added one of them as a link. The other cannot be added as a reference because it is "not a valid assembly or COM component." It doesn’t matter, because it just has to be in the folder where the first .dll (already added as a link) can find it. So naturally, I copy it to the assembly directory, which works fine until I start using UserControls.

My usercontrol (s) contain data bindings through the viewmodel to database items. If I understand correctly, to show usercontrols in the designer, they are built in the same way as if I were running the program. The problem is that when they are built into the constructor, data bindings are also created, so some small database queries are executed. But when usercontrols are created for the designer and try to fulfill these requests, I get a dllnotfoundexception from the first .dll (including). He cannot find the second.

I thought that adding a second .dll to the GAC would help the first to find it, but it seemed like I couldn’t, because, according to gacutil, “the module should contain the assembly manifest”.

Is there a good way to solve this problem? Am I really stupid without noticing anything obvious? I tried to describe the problem as clearly as possible, if something is unclear, ask.

Thanks in advance.

EDIT: just to clarify, the DllNotFoundException that I get when I open usercontrol in design mode causes the visual studio to crash.

+3
source share
3 answers

You may want to copy the sqlite dlls to one of the following locations, depending on the version of VS.NET you are using ...

One way to find the location of a designer probe is to

  • Locate the devenv.exe file.
  • Open devenv.exe.config in Notepad
  • find the entry in it

     <probing privatePath="PublicAssemblies;PrivateAssemblies"/>
    
  • Copy these sqlite-dlls into one of these directories.

  • Restart Visual studio.

Hope this helps.

+1

You do not tell us any details about the SQLite files, so the following is my guess:

Most likely, you have a .NET dll, which is the ADO.NET data provider for SQLite, and the other is probably not a .NET dll, which is SQLite itself. You just need the same place as the ADO.NET Data Provider DLL

0
source

All Articles