L5Sharp 0.15.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package L5Sharp --version 0.15.2
                    
NuGet\Install-Package L5Sharp -Version 0.15.2
                    
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="L5Sharp" Version="0.15.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="L5Sharp" Version="0.15.2" />
                    
Directory.Packages.props
<PackageReference Include="L5Sharp" />
                    
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 L5Sharp --version 0.15.2
                    
#r "nuget: L5Sharp, 0.15.2"
                    
#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 L5Sharp@0.15.2
                    
#: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=L5Sharp&version=0.15.2
                    
Install as a Cake Addin
#tool nuget:?package=L5Sharp&version=0.15.2
                    
Install as a Cake Tool

L5Sharp

A library for intuitively interacting with Rockwell's L5X import/export files.

Purpose

The purpose of this library is to offer a reusable, strongly typed, intuitive API over Rockwell's L5X schema, allowing developers to quickly modify or generate L5X content. In doing so, this library can aid in creation of tools or scripts that automate the PLC development, maintenance, or testing processes for automation engineers.

Goals

The following are some high level goals this project aimed to accomplish.

  1. Provide a simple and intuitive API, making the learning curve as low as possible.
  2. Ensure performance as much as possible without sacrificing simplicity.
  3. Make it easy and seamless to extend the API to support custom queries or functions.
  4. Support strongly typed mutable tag data, so we can reference complex structures statically at compile time.

Packages

There are two separate packages as described below.

Project Description
L5Sharp Contains core components, elements, base classes, and logix types.
L5Sharp.Extensions Contains useful methods for core classes extending the base API.

The core L5Sharp project attempts to simply model the L5X schema without adding too much ancillary functionality. This way the project hopefully won't change very often. Changes should (ideally) only be precipitated by bug fixes or further understanding of the L5X schema.

Any custom or additional helper functionality will be added to the L5Sharp.Extensions project. This allows you to opt in only if you like or need to use these additional features. If you wish to create your own, you can achieve this using C# extension methods and LINQ to XML for the core classes, all of which implement ILogixSerializable to retrieve the underlying XElement object.

Quick Start

Install package from Nuget.

Install-Package L5Sharp

If you want both packages, you can install L5Sharp.Extensions, which has a dependency on L5Sharp.

Load an L5X file using the primary entry point LogixContent class.

var content = LogixContent.Load("C:\PathToMyFile\FileName.L5X");

Get started by querying any type across the L5X using the Find<T>() and LINQ extensions.

var results = content.Find<Tag>()
                .SelectMany(t => t.Members())
                .Where(t => t.DataType == "TIMER")
                .Select(t => new { t.TagName, t.Description, t.Value.As<TIMER>().PRE })
                .ToList();

The above query gets all tags and their nested tag members of type TIMER and returns the TagName, Description, and Preset value in a flat list.

Find<T>() returns an IEnumerable<T>, allowing for complex queries using LINQ and the strongly typed objects in the library. Since Find<T>() queries the entire L5X for the specified type, the above query will return all Tag components found, including controller and program tags.

Usage

The following is some basic examples of how you can use this library to query and modify the L5X content.

Querying

Once the LogixContent is created, you can use the container properties to get access to all of the primary L5X components, such as Tag, DataType, Module, Program, and more. The following shows some simple querying via the Tags component container.

//Get all controller tags. 
var tags = content.Tags.ToList();

//Get a tag by name.
var tag = content.Tags.Find("MyTag");

//Use LINQ to query further.
var results = content.Tags.Where(t => t.DataType == "TIMER");
Modifying

Modifying components is simple as well. The same component collection interface offers methods for adding, removing, and updating components.

//Add a new component.
var tag = new Tag { Name = "MyTag", Value = 100 };
content.Tags.Add(tag);

//Remove an existing component.
var result = content.Tags.Remove("MyTag");

//Repalce an existing component.
var result = content.Tags.Find("MyTag").Replace(tag);

//Configure individual properties.
var tag = content.Tags.Get("MyTag");
tag.Value = 100;
tag.Description = "This is an update";
tag.ExternalAccess = ExternalAccess.ReadOnly;
tag.Constant = true;

//Apply update funtion to all components that satisfy a condition.
content.Tags.Update(t => t.DataType == "TIMER", t => t.Description = "Updated TIMER description");

//Save changes when done.
content.Save("C:\PathToMyOutputFile\FileName.L5X");

Documentation

See my GitHub Page here for more in depth articles and API documentation. The documentation is always a work in progress. If you think something is unclear or can be improved upon, feel free to let me know in the issues tab of the project repository.

Feedback

If you like or use this project, leave a star. If you have questions or issues, please post in the issues tab of the project repository. Any feedback is always appreciated. Enjoy!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on L5Sharp:

Package Downloads
L5Sharp.Logix

Adds support to load L5X files from ACD file using Logix SDK.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.3.0 338 5/23/2025
5.2.0 122 5/23/2025
5.1.0 216 5/5/2025
5.0.0 198 5/4/2025
4.8.3 267 4/1/2025
4.8.2 216 3/31/2025
4.8.1 189 3/28/2025
4.8.0 215 2/15/2025
4.7.3 199 12/10/2024
4.7.2 188 11/28/2024
4.7.1 170 11/15/2024
4.7.0 163 11/15/2024
4.6.0 171 11/14/2024
4.5.0 169 11/11/2024
4.4.0 187 10/31/2024
4.3.0 171 10/30/2024
4.2.0 411 10/8/2024
4.1.0 167 10/7/2024
4.0.0 172 10/5/2024
3.3.1 191 9/24/2024
3.3.0 210 7/29/2024
3.2.0 194 7/7/2024
3.1.0 177 7/5/2024
3.0.0 182 6/3/2024
2.3.2 280 5/9/2024
2.3.1 529 5/6/2024
2.3.0 205 5/4/2024
2.2.1 185 4/29/2024
2.2.0 195 4/23/2024
2.1.0 182 4/18/2024
2.0.0 260 4/4/2024
0.19.7 216 3/27/2024
0.19.6 304 3/22/2024
0.19.5 195 3/9/2024
0.19.4 202 2/5/2024
0.19.3 175 2/3/2024
0.19.1 190 1/16/2024
0.19.0 166 1/16/2024
0.18.3 201 1/8/2024
0.18.2 186 1/4/2024
0.18.1 159 12/29/2023
0.18.0 235 12/9/2023
0.17.0 216 12/8/2023
0.16.1 170 11/28/2023
0.16.0 170 11/28/2023
0.15.2 268 8/18/2023
0.15.1 212 8/17/2023
0.15.0 276 8/16/2023
0.14.0 270 8/9/2023
0.13.0 277 8/6/2023
0.12.0 241 8/1/2023
0.11.0 247 7/12/2023
0.10.1 327 3/31/2023
0.10.0 300 3/31/2023
0.9.2 296 3/24/2023
0.9.1 304 3/15/2023
0.9.0 306 3/15/2023
0.8.0 318 3/15/2023
0.7.0 291 3/14/2023
0.6.0 307 3/14/2023
0.5.3 303 3/13/2023
0.5.2 285 3/13/2023
0.5.0 310 3/13/2023
0.4.0 310 3/12/2023
0.3.0 322 3/5/2023
0.2.0 381 3/1/2023

Initial release.