我在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