我在Visual Studio中創建了一個C#項目,並使用來自http://sqlite.phxsoftware.com/的SQLite 4.0 ADO庫上的程序集。System.Data.SQLite在非開發PC上找不到
該程序在開發機器上運行良好,但是當我嘗試在另一個系統上運行它時,總會出現一個錯誤,指出找不到System.Data.SQLite.dll。我將該文件放入程序目錄中。我也試圖把它放到PATH下列出的目錄中。有什麼建議麼?
我正在使用openFileDialog來打開數據庫。這裏是相應的代碼:
con = new SQLiteConnection();
OpenFileDialog ofd1 = new OpenFileDialog();
ofd1.Filter = "db Datei (*.db)|*.db|Alle Dateien (*.*)|*.*";
if (ofd1.ShowDialog() == DialogResult.OK)
filepath = ofd1.FileName;
filepath.Replace("\\", "\\\\");
con.ConnectionString = "Data Source= \"" + filepath + "\"";
[...]
如前所述,這適用於開發機器(Windows 7,64位)。 測試機器在虛擬機中運行(Windows 7,32位)。 出現以下異常:
System.IO.FileNotFoundException: Die Datei oder Assembly "System.Data.SQLite.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Das angegebene Modul wurde nicht gefunden.
Dateiname: "System.Data.SQLite.dll"
bei WindowsFormsApplication1.Form1.button2_Click(Object sender, EventArgs e)
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Geladene Assemblys **************
mscorlib
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 (RTMRel.030319-0100).
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll.
----------------------------------------
WindowsFormsApplication1
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
CodeBase: file:///C:/Users/andi/Documents/My%20Dropbox/Own%20Public%20Folders/Public%20(Andy%20Malessa)/juralookup(Wir%20brauchen%20dringend%20nen%20Namen)/DataManagementTool/WindowsFormsApplication1.exe.
----------------------------------------
System.Windows.Forms
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 built by: RTMRel.
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.
----------------------------------------
System.Drawing
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 built by: RTMRel.
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
----------------------------------------
System
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 built by: RTMRel.
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll.
----------------------------------------
System.Windows.Forms.resources
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 built by: RTMRel.
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.
----------------------------------------
mscorlib.resources
Assembly-Version: 4.0.0.0.
Win32-Version: 4.0.30319.1 (RTMRel.030319-0100).
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_de_b77a5c561934e089/mscorlib.resources.dll.
----------------------------------------
所以基本上它說:「System.Data.SQLite.dll」或沒有被發現的依賴。
該文件存在於應用程序目錄中。這裏有一個文件清單:
你能發佈確切的錯誤信息嗎?這可能會幫助我們。 – RQDQ 2011-03-01 00:46:05
今晚我會在我工作一天後做。感謝你目前的幫助。 – twittfort 2011-03-01 11:20:45
剛剛更新了更多細節的問題。 – twittfort 2011-03-01 17:08:50