softshipper
softshipper

Reputation: 34099

Missing SAP assembly

I am trying to set up connection between SAP and .NET via RFC. SAP provides the .NET library nco3 to make a connection.

When I compile the application, it says missing assemblies, even though they are imported. You can see this on the picture:

Enter image description here

And assemblies

Enter image description here

The code does not appear with red lines

Enter image description here

Two important libraries are imported, sapnco and sapnco_utils. Why can I not compile the application?

Upvotes: 0

Views: 1310

Answers (1)

Fanda
Fanda

Reputation: 3786

You compile for the x86 architecture, but you have referenced x64 SAP libraries.

Use the proper versions of the sapnco and sapnco_utils libraries. You need to create an x86 and x64 configuration for solution. Then link the proper library based on the configuration you choose. I use this in the project file:

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

Generally, I need to also mark the assembly as 'Copy local' to true. My experiments with library installation to the GAC was not successful.

Upvotes: 4

Related Questions