我在visual studio 2010中制作一个安装项目时遇到了一些问题。我正在使用Addin-express制作一个与Microsoft Excel相关的程序,我在其中使用SQLite作为一个简单的数据库。我已经在stackoverflow上阅读了其他答案,但他们的解决方案没有帮助我。
我使用的是SQLite.net,可以在http://sqlite.phxsoftware.com找到。我无法连接到该网站,因此指向dll的直接链接是http://sourceforge.net/projects/sqlite-dotnet2/
此插件使用的是32位版本的Microsoft Office Excel,虽然我运行的是64位Windows 7,因此我在Visual Studio 2010项目中包含了32位版本的dll。我在Visual Studio调试中运行32位dll没有问题,因此我在Visual Studio安装项目中包含了相同的dll。但是,当我在我的虚拟机(也是Windows 7 64位)上运行此安装程序时,我收到以下错误和堆栈跟踪:
Detailed technical information follows:
---
(Inner Exception)
(Inner Exception)
Date and Time: 4/5/2012 7:24:52 PM
Machine Name: TOM-PC
IP Address: --------------------
Current User: Tom-PC\Tom
Application Domain: C:\Program Files (x86)\Fintools\Fintools XL\
Assembly Codebase: file:///C:/Program Files (x86)/Fintools/Fintools XL/AddinExpress.MSO.2005.DLL
Assembly Full Name: AddinExpress.MSO.2005, Version=6.5.3057.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 6.5.3057.2005
Exception Source:
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Failed to load the runtime. (Exception from HRESULT: 0x80131700)
Exception Target Site: Object reference not set to an instance of an object.
---- Stack Trace ----
(Outer Exception)
Date and Time: 4/5/2012 7:24:52 PM
Machine Name: TOM-PC
IP Address: -------------------
Current User: Tom-PC\Tom
Application Domain: C:\Program Files (x86)\Fintools\Fintools XL\
Assembly Codebase: file:///C:/Program Files (x86)/Fintools/Fintools XL/AddinExpress.MSO.2005.DLL
Assembly Full Name: AddinExpress.MSO.2005, Version=6.5.3057.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 6.5.3057.2005
Exception Source: COMWizards
Exception Type: System.IO.FileLoadException
Exception Message: Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to load the runtime. (Exception from HRESULT: 0x80131700)
Exception Target Site: GetDataTable
---- Stack Trace ----
COMWizards.SQLiteDatabase.GetDataTable(sql As String)
AddinExpress.MSO.2005.DLL: N 00000 (0x0) JIT
COMWizards.frmImpliedForwardRate.GetMostRecentDate(strDataTableName As String)
AddinExpress.MSO.2005.DLL: N 0020 (0x14) IL
COMWizards.frmImpliedForwardRate..ctor(appExcel As _Application, Path As String)
AddinExpress.MSO.2005.DLL: N 0110 (0x6E) IL
COMUI.AddinModule.adxIFRWiz_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean)
AddinExpress.MSO.2005.DLL: N 0007 (0x7) IL
AddinExpress.MSO.ADXRibbonButton.DoInternalAction(e As ADXRibbonOnActionEventArgs)
AddinExpress.MSO.2005.DLL: N 0035 (0x23) IL
(Outer Exception)
Date and Time: 4/5/2012 7:24:52 PM
Machine Name: TOM-PC
IP Address: ----------------------
Current User: Tom-PC\Tom
Application Domain: C:\Program Files (x86)\Fintools\Fintools XL\
Assembly Codebase: file:///C:/Program Files (x86)/Fintools/Fintools XL/AddinExpress.MSO.2005.DLL
Assembly Full Name: AddinExpress.MSO.2005, Version=6.5.3057.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 6.5.3057.2005
Exception Source:
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: An error has occured in the code of the add-in.
Exception Target Site: Object reference not set to an instance of an object.
---- Stack Trace ----
我尝试使用“Any CPU”和“x86”平台构建此项目,但两者都没有。我已经尝试使用64位版本的DLL,它给了我badimageformat异常,这让我相信32位版本是正确的版本使用。我已将system.data.sqlite.dll放在我的插件的根文件夹和excel的根文件夹中,但都没有解决我的问题。我完全没有想法,虽然我是一个没有经验的.NET程序员,所以我在这里寻求有关如何解决这个问题的建议。
感谢您的投入。
答案 0 :(得分:2)
请使用这个更新的system.data.sqlite.dll,它支持最新版本的sqlite和.Net:
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki