C# core libraries

The C# core libraries are part of the PLCnext Technology Toolchain and will available in the PLCnext Technology Toolchain installation folder.

These libraries are necessary to program and build real-time C# applications for PLCnext Control devices. They are replacing the equally named .NET libraries with a subset of their functionality, and adding PLCnext-specific libraries. This subset is optimized for real-time PLC use cases and do not offer any GUI-related or enhanced asynchronous implementation, which from time to time could lead to code which is unpredictable.

Nonetheless, PLCnext programming in C# offers much more flexibility, functionality and performance than programming in IEC 61131‑3 languages. Functions and function blocks written in C# can be used to enhance your application and speed up your development process.

Phoenix Contact does not recommend to program C# without Visual Studio®. Without Intellisense and code analyzer, unrecognized coding errors could lead to runtime issues and harm your system stability.

For your first project follow the steps in Creating a C# firmware library. The necessary PLCnext libraries for C# programs (eclrlib, IecEngineering and pcoslib) are referenced by default.

Important: Do not add the mscorelib manually to your Visual Studio Project! The PLCnext-adapted mscorelib is automatically added in the Visual Studio® but is not visible in the References branch.

Adding System and System.Core libraries

If needed, the System and System.Core libraries can be added by right-clicking on References → Add Reference...:

Solution Explorer

Note: The PLCnext Runtime System only works with versions of the System and System.Core libraries created by Phoenix Contact. They can be identified by black text (instead of gray) and the Phoenix Contact mentioning in the Created by: entry.

Reference new libraries

The build output of PLCnextFirmwareLibraries is also offering a .dll file, which can be referenced in other projects.

 

 


• Published/reviewed: 2024-05-06   ★  Revision 068 •