2009-02-19 43 views
1

我正在嘗試引用位​​於應用程序路徑中的System.Data.SQLite,以便我可以將其與應用程序打包在一起。我曾嘗試幾種不同的方式,包括:在應用程序路徑中引用程序集

#1 
clr.AddReferenceToFile("System.Data.SQLite.DLL") 

#2 
clr.AddReferenceToFileAndPath("C:\\Path\\To\\System.Data.SQLite.DLL") 

#3 
sys.path.append(os.getcwd()) 
clr.AddReferenceToFile("System.Data.SQLite.DLL") 

每次它要麼給我一個錯誤:「無法加載組件System.Data.SQLite」或它無法找到指定的文件。

回答

2

我們一般添加在工作中引用的方法如下:

import sys 
import clr 
# forward slashes work fine here and don't need to be escaped 
sys.path.append('c:/path/to/directory/containing/dll') 
clr.AddReference('System.Data.SQLite') # note lack of .dll 
+0

我試試看,並找回你。謝謝 – 2009-02-20 23:54:03

1

確保sqlite3.dll在您的路徑,或者您正在使用具有的sqlite3的SDSQLite的版本。嵌入在它的DLL。

相關問題