The eCLR programming system
The eCLR programming system for C# programming consists of the three main components:
- CIL compiler
- eCLR core libraries
- eCLR runtime = embedded Common Language Runtime
CIL compiler
The CIL compiler is responsible for translating the CIL code. The eCLR CIL compiler is an ahead-of-time compiler. This means that the CIL code has been fully translated for the platform before being transferred to the controller (and more importantly, before execution).
This fulfills an essential requirement for the real-time capability of the system. The functional scope of the CIL compiler enables the use of many C# language elements and namespaces of the base class library, which are listed in Section C# language functions.
eCLR core libraries
The eCLR core libraries contain the eCLR base class libraries (in versions 3.2 and 3.3) that implement real-time capable, adapted parts of the .Net™ framework class libraries:
- mscorelib.dll
- System.dll
- System.Core.dll
In addition, the eCLR core libraries contain some eCLR-specific libraries:
- eclrlib.dll
- pcoslib.dll
- IecEngineering.dll
eCLR Programming Reference
After installing the Visual Studio® C# Extension you find the eCLR Programming Reference online help in every eCLR project.
Here you find the eCLR programming reference:Show where to find the files in Visual Studio®
In Visual Studio, open your C# project and expand the EclrFirmwareLibrary branch in the Solution Explorer in the upper right corner of the screen.

With that eCLR-Programming-Reference.chm file, the eCLR base class libraries' description is at hand while programming.
Note: This reference is always downwards compatible to former eCLR versions. Make sure to come back and update your local eCLR-Programming-Reference.chm file over time.
Known issues and constraints of the current version are linked on the start page of this online help file.
In addition, a Readme.txt file in Visual Studio® contains a "cheat sheet" for common procedures in programming, along with a short overview how the IEC 61131‑3 data types are matching to .Net™ and C# data types.
AddIn Analyzer
Available from PLCnext Technology Toolchain 2022.0
The Addin Analyzer helps to avoid the known issues and constraints and prevents you from coding patterns which could build correctly but would cause runtime issues. It also provides suggestions to follow coding guidelines for more performant and reliable applications.
Adding the AddIn Analyzer to existing projects
The AddIn Analzyer can also be added to older projects. In the Visual Studio® Solution Explorer, right-click References → Add Analyzer.... From the dialog select Browse... and navigate to your local PLCnext Technology Toolchain installation directory (default: C:\Program Files\PHOENIX CONTACT\PLCnext_Toolchain) and into the eCLR directory. Select the IecAnalyzer.dll and click Add.
Disabling the AddIn Analyzer
We do not recommend to disable the AddIn Analyzer in its entirety. It is possible to disable specific errors to be able to build an erroneous project. This happens on your own risk. To do so, right-click on a specific error type in the Error List of Visual Studio® right-click on the specific error, then select Set severity → Silent.
eCLR runtime
The eCLR runtime executes the compiled CIL code on the controller. The runtime is responsible for object and memory management, metadata processing (e.g., for debugging), as well as for the transition of managed API calls to native implementation specific to the operating system.
See also