Table of Contents
This document helps the learner understand how to determine which versions of various products you will need to setup your development environment. This includes:
- Visual Studio version
- .NET Framework version
- AF SDK Version
This upcoming video series should be fun as you begin to dive into writing code with the PI AF SDK. You will be using Visual Studio to create a Windows Form (or WinForm) application named AF Applet. The examples shown are in C#, but you may follow along with VB.NET if you would prefer.
To complete this course, the AF Applet will use PI Notifications 2016 or later. This requires PI AF 2016 R2 (2.8.5) or later and this will target .NET Framework 4.5.2 or later. Some of the videos in this series may refer to older versions. Do not be distracted by this. You should instead be using the versions mentioned here within this paragraph. And hopefully, with the insights within this document, you will be well-armed to adjust to any version change in the future. Years after this course is published there will undoubtedly be even more releases of Visual Studio, .NET Framework, and PI AF SDK. The purpose of this document is to help equip the learner with the know-how to decide which versions are needed.
The original AF Applet videos were created years ago and despite their age holds up fairly well. That is mostly due to this being an introductory course, and most introductory courses stick to the more basic or foundational commands. For instance, navigating the hierarchy of an AFDatabase has remained relatively unchanged over the years. This is quite intentional as we would not have a loyal customer base if we introduced breaking changes to their production code.
However, there have been many PI AF SDK version releases since the original video series. Some of these other versions may have released new features that aren't covered within the scope of an introductory course. The most anticipated question in presenting older videos in light of newer releases is the versions of the development environment. This document will hopefully alleviate such question.
Visual Studio Versions
You may use the Community (formerly Express), Professional, or Enterprise Editions. The Community Edition is free to download.
As of this writing with PI AF SDK 2.9.x, the minimum allowed version of Visual Studio is 2012. Be keenly aware that Microsoft will deprecate Visual Studio 2012 or 2013 in the future. Also as of this writing, Visual Studio 2017 is the most recent production release and works quite nicely with PI AF SDK applications. Visual Studio 2015 also works quite nicely.
The product to avoid is Visual Studio Code as it uses .NET Core instead of the .NET Framework full release. PI AF SDK does not work with .NET Core or the product called Visual Studio Code.
.NET Framework Version
When you create a new Visual Studio project, you must target a minimum framework for the application.
You want the full release, usually lacking anything after the version number and not the Client Profile release. In the image above, the green box is highlighting .NET Framework 4.5.2.
The leads us to the most curious question: How do you determine the specific framework for your application? The short answer is to target the version required by your version of PI AF SDK. You would do this by examining the PI AF Release Notes that you may get from TechSupport Download. Browse the list of available downloads and look for anything that says "Release Notes".
Then click on Download or View. Examine the Table of Contents for the Setup section, and click on Additional Server Requirements.
You should then be presented with text similar to:
Additional Software Requirements
Microsoft Excel 2007 SP3, Microsoft Excel 2010 SP2, Microsoft Excel 2013 (32 bit or 64 bit) or Microsoft Excel 2016 (32 bit or 64 bit) is required for PI Builder. If Excel is not present, PI Builder will not be installed.
Visual Studio 2012 or later is required to develop applications with the PI AF SDK that utilize the Rich Data Access features. These applications must target .NET 4.5.2 (or later). A version of the AF SDK that is compatible with .NET 3.5, as well as Visual Studio 2008 and 2010 is also supplied, but does not encompass all the functionality of the .NET 4 AF SDK. Applications built against the 2.5.x (2012) version of the AF SDK targeting .NET 4 will continue to work with this version. If .NET 3.5 is not installed, the .NET 3.5 AF SDK and AF UI components will not be functional.
Keep in mind that future versions of PI AF SDK may possibly require .NET 4.6.1. The important takeaway here is that you now have the means to look this information up. It does not have to be a mystery or a guessing game.
Going back to the example requirements, allow me add my own emphasis:
Visual Studio 2012 or later is required to develop applications with the PI AF SDK that utilize the Rich Data Access features. These applications must target .NET 4.5.2 or later.
If you want the most secure application within your company, you may target the highest level framework. However, this choice may also be the most restrictive as anyone with a client PC with less than the targeted framework cannot run your application. If you want to reach the broadest possible audience, you should target the minimum recommended framework (in this case .NET 4.5.2). Note an application targeting .NET 4.5.2 can run on 4.6.1 but an app targeting .NET 4.6.1 cannot run on 4.5.2.
AF SDK Version
Besides the product release version, there will be two sets of assemblies installed with AF Client. The files located in PublicAssemblies are the .NET 3.5 Framework version. This version is more limited than the 4.0 versions and is missing some very important features such as supporting the PI namespace or Rich Data Access. Instead, you will want to reference the 4.0 assemblies in the PublicAssemblies\4.0 folder as shown below.
A side note: the 4.0 does not refer to a specific version of .NET 4.0 but rather any 4.x framework that is compatible with the Common Language Runtime (CLR) 4.0. Along those same lines, the .NET 3.5 Framework is compatible with CLR 2.0.
Another way to find the assemblies is from Visual Studio's Add References dialog. You can filter the list by entering "osisoft" in the upper right search box. That search will return both the .NET 3.5 and 4.x versions. Again, you will want to select the assemblies compatible with CLR 22.214.171.124.
Good luck with AF Applet and I hope you enjoy the series.