OSIsoft AF SDK Missing assembly or reference also the reference is added

1.7k Views Asked by At

I'm using OSIsoft AF SDK version 4.

After adding the reference and all everything is working fine and visual studio can see the OSISoft namespace and all. But when I try to build I get this error in the output windows and the build fails.

The type or namespace name 'OSISoft' could not be found (are you missing a using directive or an assembly reference?)

Is there any solution to this?

I removed and readded the reference. Opened and closed VS and checked the .Net framework version(actually I tried all available versions). But still, build fails and the same errors persist.

1

There are 1 best solutions below

0
On BEST ANSWER

When adding your reference for the AF SDK, you should use the 4.0.0.0 version located in the GAC Assemblies and not pick it directly from the file explorer! This implies that your AF SDK installation is done properly via the PI AF Client installation kit.

  • The 2.0.0.0 Assembly targets .net framework 3.5 and is a legacy/obsolete version of the AF SDK
  • The 4.0.0.0 Assembly targets the most recent version of the .Net framework.

enter image description here More information in the PI AF SDK Documentation here: PI AF SDK Documentation

Deployment of your compiled code: The target client computer for your code must have PI AF Client installed (AF SDK is the only item necessary). Then you just need to copy the compiled executable (and your .dll if any) of your .NET application (do not use a copy of AFSDK.dll from the developement machine.). Then the .dlls from the GAC will be used on the client and everything will work as expected.