0

我正在尝试在 Visual Studio for SAP B1 版本 10.00.150 中以调试模式 (x64) 运行插件。这个插件在 9.3 版本中运行良好。

我已使用代码中的正确版本更新了 SAP bob 和 boui 的 .dll 文件。这是一个 Hana DB。我已确保已输入正确的连接字符串以进行调试。

我以管理员身份运行 SAP B1 客户端 x64 和 Visual Studio。

但是,我在这一行得到一个错误:

// First initialize the Company object
Company = new SAPbobsCOM.Company();

错误:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'SAP_DMS_Integration.Helpers.SboConnection' threw an exception.
Source=SAP_DMS_Integration
StackTrace:
at SAP_DMS_Integration.Helpers.SboConnection.get_SboApplication() in C:\Users\sconsult1\Desktop\CCL\DMS\SAP_DMS_Integration\SAP_DMS_Integration\Helpers\SboConnection.cs:line 17
at SAP_DMS_Integration.GUI..ctor() in C:\Users\sconsult1\Desktop\CCL\DMS\SAP_DMS_Integration\SAP_DMS_Integration\GUI.cs:line 33
at SAP_DMS_Integration.Program.Main() in C:\Users\sconsult1\Desktop\CCL\DMS\SAP_DMS_Integration\SAP_DMS_Integration\Program.cs:line 17

Inner Exception 1:
FileNotFoundException: Retrieving the COM class factory for component with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60100} failed due to the following error: 8007007e The specified module could not be found. (Exception from HRESULT: 0x8007007E).

这是运行的 SAP 版本:

在此处输入图像描述

我在代码中为版本添加了正确的 .dll 文件:

在此处输入图像描述

如何修复此错误?

4

2 回答 2

1

该错误意味着 .net 运行时无法找到并实例化 DI-API COM 对象。问题可能是由于以下原因之一:

  • 未安装 DI-API
  • 已安装 DI-API 的位数与您的插件的位数不匹配
  • 您安装了 9.x DI-API(不同的 COM GUID)

正确的 DI-API 通常与 v10 客户端一起安装,但我认为这不是先决条件。如果您安装了 DI-API,它通常会显示在 Windows 添加/删除软件列表中。确保已安装,如果已安装,请尝试重新安装。

于 2021-07-15T07:42:19.963 回答
0

我建议您始终在要运行项目的位置安装 32 位和 64 位版本的 DI API,并在您的项目中引用 SAP Business One SDK DLL(因为它会选择正确的 DI API,所以麻烦较少版本(位)取决于环境。

Daz 提到了位,这就是我在这里所说的,只是把它拼写得更清楚一点:P 100% 的时间我都在为组件检索 COM 类工厂而苦苦挣扎,这是因为我安装了错误的 DI API . 有时我确信我不需要 32 位,但我的项目可能包含另一个 DLL,它强制项目构建为 32 位,因此 DI API 64 位是不够的。

于 2021-09-19T23:17:48.280 回答