libplctag 1.6.0-alpha.0

This is a prerelease version of libplctag.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package libplctag --version 1.6.0-alpha.0
                    
NuGet\Install-Package libplctag -Version 1.6.0-alpha.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="libplctag" Version="1.6.0-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="libplctag" Version="1.6.0-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="libplctag" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add libplctag --version 1.6.0-alpha.0
                    
#r "nuget: libplctag, 1.6.0-alpha.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package libplctag@1.6.0-alpha.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=libplctag&version=1.6.0-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=libplctag&version=1.6.0-alpha.0&prerelease
                    
Install as a Cake Tool

libplctag.NET

libplctag is a C library for Linux, Android, Windows and macOS that uses EtherNet/IP or Modbus TCP to read and write tags in PLCs.

libplctag.NET provides wrapper packages for libplctag, with an API naturalised to .NET by adding the following features:

  • Values are strongly-typed
  • Errors are thrown as Exceptions
  • Async/Await
  • Native resource cleanup

How to use

// Example tag configuration for a global DINT tag in an Allen-Bradley CompactLogix/ControlLogix PLC
var myTag = new Tag()
{
    Name = "SomeDINT",
    Gateway = "10.10.10.10",
    Path = "1,0",
    PlcType = PlcType.ControlLogix,
    Protocol = Protocol.ab_eip
};

// Read the value from the PLC
myTag.Read();
int originalValue = myTag.GetInt32(0);        
Console.WriteLine($"Original value: {originalValue}");

// Write a new value to the PLC
int updatedValue = 1234;
myTag.SetInt32(0, updatedValue);
myTag.Write();    
Console.WriteLine($"Updated value: {updatedValue}");

See the examples projects for further detail and usage:

Introduction

A tag is a local reference to a region of PLC memory. Depending on the PLC type and protocol the region may be named. For some protocols, the region is simply a type and register number (e.g. Modbus). For other protocols, it is a name, possible array element, field names etc. (e.g. a CIP-based PLC).

Your program directly controls the resources associated with the connection to the PLC. It initializes these resources through the Initialize() function and frees the resources used with the Dispose() function. The lowest level of access to a tag is via the Read() and Write() operations. In most cases you must explicitly call these functions to write to the PLC or read from the PLC. There are also attributes that can be passed when creating a Tag to make it either automatically write to the PLC when the local copy of the tag is updated or read from the PLC periodically, or both. Once initialized, the tag memory is exposed as a byte array, and can be manipulated using various data accessors.

Libplctag does not expose the concept of a PLC. Just tags.

Read more on the libplctag wiki.

libplctag.Tag

libplctag.NET provides a wrapper for the C API naturalised for .NET. The Tag class is intended to be functionally equivalent to the C API.

For example:

Some methods are presented slightly differently due to the differences in languages and language idioms. For example, the counterpart to Initialize(..) is plc_tag_create(..) and the tag attributes are specified as properties (e.g. Tag.Path).

Data Accessors

Mapping the raw tag buffer to some typed value (e.g. int) and vice-versa can be achieved using the built-in Data Accessor methods. Alternatively, get a copy of the byte array with GetBuffer(..) and do the conversion yourself (e.g. with BitConverter, BinaryPrimities, Encoding, or manually).

In general, you will need prior knowedge of the binary format of the tag data, and you may need to reverse-engineer it. The manuals provided by your device manufacturer are the best source of information on these details.

libplctag.LibPlcTag

This is a static class used to access some utility features of the libplctag base library such as global debug levels and logging.

libplctag.NativeImport

The libplctag package depends on the core libplctag libraries which are written in C and are released as native binaries. The delivery of these files, and the interop to the .NET environment is provided by the libplctag.NativeImport package.

Information on this package can be found here.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 is compatible.  netcoreapp3.1 is compatible. 
.NET Framework net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on libplctag:

Package Downloads
clxx.libplctag.NET

A high level API for reading/writing tags to Rockwell CLX PLCs. ControlLogix and CompactLogix.

MgSoftDev.IndustrialController.AllenBradley.LibPlcTagNetCore

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0-alpha.5 889 7/20/2025
1.6.0-alpha.4 3,791 2/1/2025
1.6.0-alpha.3 115 1/29/2025
1.6.0-alpha.2 83 1/14/2025
1.6.0-alpha.1 133 1/1/2025
1.6.0-alpha.0 2,217 7/26/2024
1.5.2 42,956 7/13/2024
1.5.1 1,153 7/12/2024
1.5.0 200 7/12/2024
1.4.1 1,674 6/22/2024
1.4.0 526 6/15/2024
1.3.1 164 6/15/2024
1.3.0 374 6/15/2024
1.2.1 5,161 5/29/2024
1.2.0 28,896 11/6/2023
1.2.0-alpha.2 112 10/29/2023
1.2.0-alpha.1 1,032 10/22/2023
1.2.0-alpha.0 3,204 7/4/2023
1.1.1 48,395 12/14/2022
1.1.1-beta.0 205 12/1/2022
1.1.1-alpha.1 220 11/25/2022
1.1.1-alpha.0 211 11/24/2022
1.1.0 7,781 10/9/2022
1.1.0-alpha.2 275 10/1/2022
1.1.0-alpha.1 2,648 12/27/2021
1.0.14-beta.6 1,493 12/21/2021
1.0.14-beta.5 769 11/5/2021
1.0.14-beta.4 282 10/28/2021
1.0.14-beta.3 291 10/27/2021
1.0.14-beta.2 387 10/23/2021
1.0.14-beta.1 390 10/23/2021
1.0.13 12,579 10/14/2021
1.0.12 559 10/14/2021
1.0.11 2,338 9/24/2021
1.0.10 628 9/22/2021
1.0.9 618 9/18/2021
1.0.8 741 8/30/2021
1.0.7 1,254 8/16/2021
1.0.7-alpha.3 283 8/13/2021
1.0.7-alpha.2 435 7/20/2021
1.0.7-alpha 143 7/20/2021
1.0.6 939 7/18/2021
1.0.5 2,007 5/29/2021
1.0.4 3,778 3/7/2021
1.0.4-beta.1 282 2/16/2021
1.0.3 1,290 1/11/2021
1.0.2 615 1/6/2021
1.0.1 1,475 11/15/2020
1.0.0 1,024 9/16/2020
0.0.29-alpha01 549 9/10/2020
0.0.28-alpha02 497 9/9/2020
0.0.28-alpha01 467 9/9/2020
0.0.27-alpha13 520 8/4/2020
0.0.27-alpha12 558 7/29/2020
0.0.27-alpha11 496 7/27/2020
0.0.27-alpha10 479 7/24/2020
0.0.27-alpha09 522 7/21/2020
0.0.27-alpha08 532 7/19/2020
0.0.27-alpha07 479 7/14/2020
0.0.27-alpha06 477 7/14/2020
0.0.27-alpha05 468 7/14/2020
0.0.27-alpha04 533 7/9/2020
0.0.27-alpha03 562 7/9/2020
0.0.27-alpha02 507 7/9/2020
0.0.27-alpha01 535 7/3/2020
0.0.26-alpha01 479 7/1/2020
0.0.25-alpha01 503 6/30/2020
0.0.24 1,051 4/4/2020
0.0.22 816 1/10/2020
0.0.21 815 1/4/2020
0.0.20-alpha 543 1/4/2020
0.0.19-alpha 549 1/4/2020
0.0.18-alpha 536 1/4/2020
0.0.17-alpha 552 1/4/2020
0.0.16-alpha 554 1/4/2020
0.0.15-alpha 598 1/4/2020
0.0.14-alpha 568 1/3/2020
0.0.13-alpha 525 1/3/2020
0.0.12-alpha 581 1/3/2020
0.0.11-alpha 537 1/3/2020