Wojciech Jasiński
Wojciech Jasiński

Reputation: 1490

How can I store System.Data.SQLite.dll in subfolder?

I'm using Visual Studio to create C# application which uses SQLite database. What I want to do is save DLL file in subfolder named 'config'. I've created config folder inside bin/debug folder and copied System.Data.SQLite.dll file into it. Then I added Reference to my solution using bin/debug/config/Systtem.Data.SQLite.dll file. The problem is that every time I build solution VS creates new System.Data.SQLite.dll file directly inside bin/debug and when I try to use my application (after deleting bin/debug/System.Data.SQLite.dll) it throws an exception = it cannot load dll from inside config folder... How can I solve it?

Upvotes: 1

Views: 780

Answers (2)

lbergnehr
lbergnehr

Reputation: 1598

Here's some more info on the topic: http://msdn.microsoft.com/en-us/library/4191fzwb.aspx

Upvotes: 0

SLaks
SLaks

Reputation: 888223

You ought to use the default behavior of loading from the EXE's directory.

If you really don't want to, set Copy Local to false on the reference and load the DLL yourself by calling Assembly.Load.
Note that you'll need to load the DLL before calling any methods that use its types so that the DLL is already loaded when the runtime JITs the methods.

Upvotes: 4

Related Questions