Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top