如何解决 Quickbooks 界面错误:QBFC 错误“无法加载文件或程序集 Interop.QBFC7 或其依赖项之一"

问题描述:

我最近继承了一个 C# Winforms 应用程序,该应用程序通过 Quickbooks 的 QBFC 接口进行通信.该应用程序包含对 COM Server Interop.QBFC7.dll 的引用.该应用程序在我们的测试环境和我们客户的几个环境中运行良好.虽然,昨天当我尝试在新客户的系统上安装它时,我继续收到以下错误:

I recently inherited a C# Winforms application that communicates with Quickbooks via their QBFC interface. The application contains a reference to the COM Server Interop.QBFC7.dll. The application works fine in our test environment and in several of our client's environments. Although, yesterday when I attempted to install it on a new customer's system I continued to get the following error:

无法加载文件或程序集Interop.QBFC,版本=8.0.0.87,Culture=neutral,PublicKeyToken=..."或其依赖项之一.系统找不到指定的文件.

Could Not Load File or Assembly 'Interop.QBFC, Version=8.0.0.87, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.

我知道我们有几个客户在不同版本的 Quickbooks(即 2008 年和 Enterprise 11.0 之间的 Quickbooks Pro、Premier 和 Enterprise)上运行此应用程序.据我所知,这是我们尝试部署具有 Enterprise 12.0 的应用程序的第一个客户.

I know that we have several customers running this application on various versions of Quickbooks (i.e. Quickbooks Pro, Premier and Enterprise between 2008 and Enterprise 11.0). To my knowledge, this is the first customer that we have attempted to deploy this application that has Enterprise 12.0.

我尝试了以下方法来解决问题,但没有成功:

I have attempted the following to resolve the issue with no success:

1) 从 Intuit 开发者网络站点安装 QBFC7_Installer
2) 从 Intuit 开发人员网络站点安装 Quickbooks SDK 10 安装程序
3) 验证文件系统上是否存在 Interop.QBFC7.dll 文件.
4) 尝试通过命令提示符手动注册 COM 对象 Interop.QBFC7.dll:regsvr32 Interop.QBFC7.dll(同样失败,Windows 返回错误,指出找不到对象).

1) Install the QBFC7_Installer from the Intuit Developer Network Site
2) Install the Quickbooks SDK 10 Installer from the Intuit Developer Network Site
3) Verified that the Interop.QBFC7.dll file is present on the file system.
4) Attempted to manually register the COM object Interop.QBFC7.dll via the command prompt: regsvr32 Interop.QBFC7.dll (This fails as well and windows returns an error stating that it cannot find the object).

是否有人对我可以尝试解决此问题的其他事项有任何建议或反馈?我在运行不同操作系统(即 Windows Server 2008、Windows 7 和 Windows Vista)的站点的 3 台不同机器上遇到相同的错误?我也试过在 x86 和 64 位配置下编译都无济于事.

Does anyone have any suggestions or feedback about additional things that I can try to resolve this issue? I get the same error on 3 different machines at their site running different operating systems (i.e. Windows Server 2008, Windows 7, and Windows Vista)? I have also tried compiling in both x86 and 64-bit configurations to no avail.

在此先感谢您的帮助.

首先,您应该只针对 x86 构建.如果您以 Any CPUx64 为目标,QuickBooks SDK 将无法工作.但是,您的主要问题是您正在寻找错误版本的 QBFC.请注意错误消息上的版本戳:

First of all, you should be targeting an x86 build only. The QuickBooks SDK won't work if you target Any CPU or x64. Your main problem, though, is that you are looking for the wrong version of QBFC. Notice the version stamp on your error message:

无法加载文件或程序集Interop.QBFC,版本=8.0.0.87,Culture=neutral, PublicKeyToken=...' 或其依赖项之一.这系统找不到指定的文件

Could Not Load File or Assembly 'Interop.QBFC, Version=8.0.0.87, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified

这是 QBFC8,不是 QBFC7.因此,您应该能够使用 QBFC8 安装程序修复该问题.

This is QBFC8, not QBFC7. So you should be able to fix the problem with the QBFC8 installer.

QuickBooks 的版本应该没有区别,因为 QBFC 8(或 7,就此而言)将适用于 2008 和 Enterprise 11 或 12.

The version of QuickBooks should not make a difference, since QBFC 8 (or 7, for that matter) will work with the 2008 and Enterprise 11 or 12.

您应该考虑使用安装项目来安装您的应用程序,以避免将来出现此问题.安装项目应自动检测 QBFC 依赖项.看到这种情况发生后,转到安装项目的 SearchPath 属性并从安装在您机器上的 SDK 添加 MergeModule 目录.执行此操作后,您应该会看到 QBFC 和 Xerces 合并模块作为依赖项自动添加到您的项目中.当然,您还需要将代码更新为更新版本的 QBFC,但这在任何情况下都可能是个好主意.

You should look into using a setup project to install your application in order to avoid this problem in the future. A setup project should detect the QBFC dependency automatically. Once you see this happening, go to SearchPath property of your setup project and add the MergeModule directory from the SDK that is installed on your machine. Once you do this, you should see that the QBFC and Xerces merge modules are added to your project automatically as dependencies. Of course, you'll also need to update your code to a more recent version of QBFC, but that's probably a good idea in any case.