开发者

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

开发者 https://www.devze.com 2023-04-02 03:08 出处:网络
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

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. T开发者_如何学运维he 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?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号