Skip to main content
PI System
AF SDK
.NET Development
C#

C# and the Future of OSIsoft PI System Connectivity: Migrating to AF SDK

The PI AF SDK is now the standard for .NET development with the OSIsoft PI System, replacing the deprecated PI SDK. Learn how to read tag data in C#, access metadata, and leverage official documentation and community resources.

Roshan Soni

4 min read

Interfacing with OSIsoft PI System in C#: Transitioning from PI SDK to AF SDK

As industrial data infrastructures evolve, so do their software interfaces. If you are working on a .NET application that needs to communicate with the OSIsoft PI System, you may have noticed that the classical PI SDK is being deprecated in favor of the PI Asset Framework SDK (AF SDK). This change affects how developers connect to PI servers and access process data.

Why AF SDK?

The PI AF SDK has become the recommended library for .NET development due to its modern architecture, comprehensive feature set, and broader system compatibility. With the release of version 2.5, AF SDK can now connect not only to the PI AF Server but also directly to the PI Data Archive, making it a one-stop solution for programmatic access to the PI System.

Getting Started: Read Tag Data with C# and AF SDK

For many developers, a common starting task is reading tag data from the PI Historian as part of data validation or process analytics. With the AF SDK, you can easily access tag (PI Point) metadata and current values. Here’s a basic example in C#:

using OSIsoft.AF;
using OSIsoft.AF.PI;

// Get the default PI System and server
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
PIServer myPIServer = PIServer.FindPIServer(myPISystem, piServerName);

// Find the PI Point (tag)
PIPoint myPIPoint = PIPoint.FindPIPoint(myPIServer, piPointName);

// Read tag properties and current value
Console.WriteLine($"Name: {myPIPoint.Name}");
Console.WriteLine($"ID: {myPIPoint.ID}");
Console.WriteLine($"Type: {myPIPoint.PointType}");
Console.WriteLine($"Current Value: {myPIPoint.CurrentValue()}");

This snippet enables you to fetch key tag properties and their latest values in a straightforward manner.

Essential Resources

  • AF SDK Documentation: The best starting point is the PI AF SDK documentation.
  • GitHub Samples: OSIsoft maintains the PI-AF-SDK-Basic-Samples and PI-AF-SDK-Clues repositories for practical, self-contained code examples.
  • AF SDK Reference Manuals: Installing the PI Asset Framework Developers Kit provides help files (AFSDK.chm, AFUIRef.chm) and enables Visual Studio Intellisense for AF SDK classes. These references are typically located in %PIHOME%\Help on your PI client machine.
  • Community Forums: The PI Developers Club (PI Square) and the PI .NET Framework (PI AF SDK) forums are full of practical discussions and advanced code samples.

Summary

With the deprecation of the classic PI SDK, the AF SDK has established itself as the de facto method for .NET interfacing with the OSIsoft PI System—capable of working with both the PI Data Archive and AF Server. Existing and new .NET projects should be migrated to the AF SDK to ensure long-term support and feature access. Consult the official documentation, sample projects on GitHub, and community forums for continuous learning and up-to-date best practices.

Tags

#OSIsoft
#PI AF SDK
#C#
#PI SDK Deprecated
#PI System Connectivity
#Historian Access
#GitHub Samples

About Roshan Soni

Expert in PI System implementation, industrial automation, and data management. Passionate about helping organizations maximize the value of their process data through innovative solutions and best practices.

Sign in to comment

Join the conversation by signing in to your account.

Comments (0)

No comments yet

Be the first to share your thoughts on this article.

Related Articles

Enhancing PI ProcessBook Trends with Banding and Zones: User Needs, Workarounds, and the Road Ahead

A look at the user demand for trend banding/zoning in OSIsoft PI ProcessBook, current VBA workarounds, UI challenges, and how future PI Vision releases aim to address these visualization needs.

Roshan Soni

Migrating PIAdvCalcFilVal Uptime Calculations from PI DataLink to PI OLEDB

Learn how to translate PI DataLink's PIAdvCalcFilVal advanced calculations—like counting uptime based on conditions—into efficient PI OLEDB SQL queries. Explore three practical approaches using PIAVG, PIINTERP, and PICOunt tables, and get tips for validation and accuracy.

Roshan Soni

Understanding PI Web API WebID Encoding: Can You Generate WebIDs Client-Side?

Curious about how PI Web API generates WebIDs and whether you can encode them client-side using GUIDs or paths? This article explores the encoding mechanisms, current documentation, and best practices for handling WebIDs in your applications.

Roshan Soni