缺少 SAP 组件

问题描述 投票:0回答:1

我正在尝试通过 RFC 在 SAP 和 .NET 之间建立连接。 SAP 提供 .NET 库 nco3 来建立连接。

当我编译应用程序时,它显示缺少程序集,即使它们已导入。你可以在图片上看到这一点:

Enter image description here

和组件

Enter image description here

代码不出现红线

Enter image description here

导入了两个重要的库,sapncosapnco_utils。为什么我无法编译应用程序?

c# .net-assembly saprfc sap-dotnet-connector
1个回答
4
投票

您针对 x86 架构进行编译,但引用了 x64 SAP 库。

使用正确版本的 sapncosapnco_utils 库。您需要为解决方案创建 x86 和 x64 配置。然后根据您选择的配置链接正确的库。我在项目文件中使用它:

<Reference Include="sapnco" Condition="'$(Platform)' == 'x86'">
  <HintPath>..\Libs\sapnco\x86\sapnco.dll</HintPath>
</Reference>
<Reference Include="sapnco" Condition="'$(Platform)' == 'x64'">
  <HintPath>..\Libs\sapnco\x64\sapnco.dll</HintPath>
</Reference>
<Reference Include="sapnco_utils" Condition="'$(Platform)' == 'x86'">
  <HintPath>..\Libs\sapnco\x86\sapnco_utils.dll</HintPath>
</Reference>
<Reference Include="sapnco_utils" Condition="'$(Platform)' == 'x64'">
  <HintPath>..\Libs\sapnco\x64\sapnco_utils.dll</HintPath>
</Reference>

通常,我还需要将程序集标记为“复制本地”为 true。我将库安装到 GAC 的实验没有成功。

© www.soinside.com 2019 - 2024. All rights reserved.