9 Replies Latest reply on May 7, 2015 1:56 PM by tsokari

    Is there a nuget package for PI AF (32 bit)?

    tsokari

      I need to develop a 32 bit .Net application that talks to PI Server using PI AF SDK and I don't want to install AF client on the target machine.  I managed to build a 64 bit nuget package that seemed to do the job, but my application has to be 32 bit and it's not clear what DLLs to add to the Nuget package to get that to work...

      Any help appreciated!

        • Re: Is there a nuget package for PI AF (32 bit)?
          dng

          The OSIsoft.AFSDK.dll in Program Files (x86)\ PIPC\AF\Public Assemblies is compiled to Microsoft Intermediate Language (MSIL). At runtime, the just-in-time (JIT) compiler will compile to either 64-bit or 32-bit native byte code. The same dll can be used in 64-bit or 32-bit applications.

           

          With that said, redistributing AF SDK by copying dlls without the install kit is not supported, and is an untested scenario. We recommend installing the AF Client on target machines.

           

          Furthermore, the client machines where the applications will be deployed on must hold a PSA license, so there is also a licensing consideration here.

          1 of 1 people found this helpful
            • Re: Is there a nuget package for PI AF (32 bit)?
              tsokari

              Thanks for your swift reply.

              However it seems OSIsoft.AFSDK.dll is built specifically targeting "AMD64" architecture as I get the warning (shown below) when building a 32 bit application with it...

               

              There was a mismatch between the processor architecture of the project being built "x86" and the processor architecture of the reference "OSIsoft.PISDK, Version=1.4.0.0, Culture=neutral, PublicKeyToken=c3309f0734ba2805, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

               

              My 32 bit app does actually run when linked against it and so I would guess that when OSIsoft build the DLL, it should really be marked as "Any CPU" rather than "AMD64" to avoid the above warning.

               

              Separately, yes, I appreciate the licence issues and will license as required.  However it's not desirable to have to do a full install of AF Client on our CI Build servers and on future production machines...

               

              Many thanks for your help anyway - much appreciated.

                • Re: Is there a nuget package for PI AF (32 bit)?
                  Eugene Lee

                  Hey!

                   

                  Your error message is for OSIsoft.PISDK. This is actually different from OSIsoft.AFSDK. Other than that, I can confirm AFSDK is compiled as Any CPU.

                  • Re: Is there a nuget package for PI AF (32 bit)?
                    dng

                    Hi Tamunosepiribo,

                     

                    The OSIsoft.AFSDK.dll is built with "Any CPU". The error message you shown above is for the OSIsoft.PISDK interop library. There are indeed two versions of PI SDK, one for 32-bit (located at Program Files (x86)\PIPC\pisdk\PublicAssemblies) and another for 64-bit (Program Files\PIPC\PISDK\PublicAssemblies).

                     

                    There are two "versions" of AF SDK, one targeting .NET 3.5 and the other targeting .NET 4.0+. The 3.5 library uses PI SDK to connect to PI, but not the 4.0 library. You might not have run into an issue with your application depending on which AF SDK library you use on your 32-bit application and whether the app connects to PI. However, I would encourage you to package the 32-bit PI SDK if you do decided to go forward with the nuget package.

                • Re: Is there a nuget package for PI AF (32 bit)?
                  bshang

                  In addition to what Daphne said, there are some additional prerequisites for AF SDK that installing the AF Client using the install kit would check and provide (PI SDK (for .NET 3.5), proper KST, PI Network Manager, PINet DLL's in the GAC).

                    • Re: Is there a nuget package for PI AF (32 bit)?
                      tsokari

                      Hello and thanks for your swift reply.

                       

                      Having to do a full AF Client SDK install on CI build machines and also production machines isn't really practical or desirable; it would be much better if I could just include the required DLL(s) with my application.

                       

                      However you mention prerequisites - "KST, PI Network Manager PINet" - and being a relative PI newbie I'm not familiar with these.  All I'm trying to do is read and write PIPoints using the AF SDK in a32 bit .Net app - are these actually prerequisites for my use-case?

                        • Re: Is there a nuget package for PI AF (32 bit)?
                          Eugene Lee

                          Yes they are prerequisites because you need KST (known servers table) to be able to detect the PIServer and PI Network Manager is a service to allow you to make connections to the PI Data Archive etc. Therefore, they come as a package. Without this service, you cannot talk to the PI Data Archive from your client machine.

                            • Re: Is there a nuget package for PI AF (32 bit)?
                              tsokari

                              Hello again,

                              my apologies for the mistake with the wrong DLL - indeed the AF Client DLL now builds ok with my 32 bit app - thanks!

                               

                              It's a bit of a drag to discover I have to do a full AF SDK install on every machine - even CI build machines that just package up the app will never actually run the application...

                               

                              But thanks anyway!

                            • Re: Is there a nuget package for PI AF (32 bit)?
                              dng

                              Yes, KST (known servers table - registry entry), PI Network Manager (a windows service), PINet dlls are necessary for an AF SDK application to connect to PI. These components normally get installed with the install kit. At this point, we don't recommend redistributing AF SDK by copying dlls without the install kit.