This site uses cookies for functional purposes. To continue please read and agree to our Data Privacy.

By closing this message, you consent to our use of cookies on this device.

PLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community


 How to create a Blog Entry

How to use the .Net Core on a PLCnext Control

If you're a C# programmer working with a PLCnext Control then you might want to use the Microsoft® .NET Core runtime. Here's how to install it on an AXC F 2152 control.

Set up the runtime on the PLC

  1. Download the Dotnetcore Runtime Binaries
  2. Unzip the Runtime .zip file
  3. Unzip the Data folder
  4. Copy the unzipped files (host, shared and dotnet binary) to the controller at /opt/DotnetRT
  5. Create a symlink to the binary (as root user) ln -s /opt/DotnetRT/dotnet /usr/local/bin/dotnet
  6. Check if the link is setup correctly: lrwxrwxrwx 1 admin plcnext 20 Nov 27 12:50 dotnet -> /opt/DotnetRT/dotnet
  7. Check if installation was succesfull: dotnet --info
admin@axcf2152:/opt/plcnext$ dotnet --info 
Host (useful for support): 
    Version: 2.1.1 
    Commit: 6985b9f684 

.NET Core SDKs installed: 
    No SDKs were found. 

.NET Core runtimes installed: 
    Microsoft.NETCore.App 2.1.1 [/opt/DotnetRT/shared/Microsoft.NETCore.App

Create a project

  1. Switch to a PC for development and building of your .Net Core apps
  2. Install .Net Core SDK
  3. Create a new application dotnet new console -o MyFirstTestProgram
  4. Switch to the folder MyFirstTestProgram
  5. Write your code at Program.cs - by default there is a "Hello World!" program
  6. Build it with dotnet build
  7. Switch to MyFirstTestProgram/bin/Debug/netcoreappX.X/
  8. Modify MyFirstTestProgram.runtimeconfig.json and set "System.Globalization.Invariant": true
    "runtimeOptions": { 
        "tfm": "netcoreapp2.1", 
        "framework": { 
            "name": "Microsoft.NETCore.App", 
            "version": "2.1.0" 
    "configProperties": { 
            "System.Globalization.Invariant": true 

Deploy and run your application

  1. Copy MyFirstTestProgram/bin/Debug/netcoreappX.X/ to the controller at /opt/MyFirstTestProgram
  2. Execute the .Net application with dotnet MyFirstTestProgram/netcoreapp2.1/MyFirstTestProgram.dll
Hello World! 

How to access I/O data from a C# application running on the .Net Core

With the upcoming firmware 2.0 of PLCnext Technology (available by the end of 2018) it will be possible to access the GDS and the I/Os in an easy way via an API.

In the meantime use workarounds, like net sockets, Modbus or a REST implementation in a C++ ESM program.

Most clicked articles in the makers blog