缺少 sap 组件

Missing sap assembly

我正在尝试通过 rfc 在 sap 和 .net 之间建立连接。 SAP 提供 dot net 库 nco3 来建立连接。

当我编译应用程序时,它说缺少程序集,即使它们是导入的。你可以在图片上看到这个

和程序集

代码没有出现红线

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

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

使用正确版本的 sapnco 和 sapnco_utils 库。您需要为解决方案创建 x86 和 x64 配置。比 link 根据您选择的配置选择合适的库。我在项目文件中使用这个:

<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>

通常我还需要将程序集标记为 'Copy local' 为真。我将库安装到 GAC 的实验没有成功。