Referenceable libraries in the System namespace

The PLCnext Technology programming system for C# needs referenced libraries which are specifically built for the eCLR runtime. For this, we introduced our own framework (similar to .NET framework) and the eCLR base class libraries.

This approach takes care that it's always downward compatible: libraries built with the eCLR 3.1 framework are running on newer versions of the eCLR framework without any issues. Upward compatibility is also given, as long as the library developer takes care that his program uses new functions only on systems where they are already implemented.

eCLR Core Libraries

As already mentioned at eCLR programming system, the eCLR comes with three base class libraries (mscorelib.dll, System.dll, and System.Core.dll) and three eCLR-specific libraries (eclrlib.dll, pcoslib.dll, and IecEngineering.dll).

The eCLR-specific libraries are referenced in the eCLR project templates by default. The mscorelib.dll is automatically referenced by Visual Studio and can not be added manually. If you change your project's target framework the dedicated libraries will be exchanged as well.

change target framework

The System.dll and System.Core.dll behave different and the developer needs to keep care of it himself. It is not part of the default references and does not change automatically on changing the target framework version.

It needs to be added and changed manually:

  1. Right click on References and select Add Reference...
    add_reference
  2. Select the library

    Choose the one named System or System.Core, created by Phoenix Contact GmbH & Co. KG and with the correct version.

    add_reference

    In the current state of development, the System.Core does not yet include any functionality. Nevertheless, as long as it is referenced, it avoids to get any Intellisense hints for .NET framework functionalities that would mislead the developer.

  3. Check for troubling libraries

    Referencing one of the libraries created by Microsoft Corporation (they're slightly grayed out in the list) will retarget the project to .NET framework 4.0, so it is not running on PLCnext devices anymore (regard the warning sign):

    target .Net 4.0 library

    You have to change it back in the project settings and delete the reference in order to work with PLCnext Technology.

Referencing custom libraries

Sometimes it's helpful to have a "helper library" at hand or reuse functions from other projects.

These libraries must also be built with the eCLR target framework. In the build output of your PLCnext project there's a .dll (next to the PLCnext Engineer library) which can be referenced in other projects.

 

 


• Published/reviewed: 2024-09-24   ☀  Revision 073 •