我正尝试在Visual Studio for SAP B1 version10.00.150中以调试模式(x64)运行一个插件。这个插件在9.3版本中运行良好。
我已经用代码中的正确版本更新了SAP和boui的.dll文件。这是一个Hana DB。我已经确保为debug输入了正确的连接字符串。
我以管理员身份同时运行SAP 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文件:

如何修复此错误?
发布于 2021-07-15 15:42:20
该错误意味着.net运行时无法找到并实例化DI-API对象。该问题可能是由于以下原因之一:
未安装
正确的DI-API通常与v10客户端一起安装,但我不认为这是先决条件。如果你安装了DI-API,它通常会出现在Windows的Add/Remove Software列表中。确保它已安装,如果已安装,请尝试重新安装。
发布于 2021-09-19 23:17:48
我建议您始终在要运行项目的位置安装DI API的32位和64位版本,并在您的项目中引用SAP Business One SDK DLL (不太麻烦,因为它将根据环境选择正确的DI API版本(位)。
Daz提到了bitness,这就是我在这里所说的,只是更详细地说明了一下:P 100%的时间我都在为组件检索COM类工厂而苦苦挣扎,这是基于我安装了错误的DI API。有时我确信我不需要32位,但我的项目可能包含另一个DLL,迫使项目构建为32位,因此DI 64位是不够的。
https://stackoverflow.com/questions/68367186
复制相似问题