L5Sharp.Generators.Data 7.2.0

dotnet add package L5Sharp.Generators.Data --version 7.2.0
                    
NuGet\Install-Package L5Sharp.Generators.Data -Version 7.2.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="L5Sharp.Generators.Data" Version="7.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="L5Sharp.Generators.Data" Version="7.2.0" />
                    
Directory.Packages.props
<PackageReference Include="L5Sharp.Generators.Data" />
                    
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.Generators.Data --version 7.2.0
                    
#r "nuget: L5Sharp.Generators.Data, 7.2.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 L5Sharp.Generators.Data@7.2.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=L5Sharp.Generators.Data&version=7.2.0
                    
Install as a Cake Addin
#tool nuget:?package=L5Sharp.Generators.Data&version=7.2.0
                    
Install as a Cake Tool

L5Sharp.Generators.Data

A Roslyn incremental source generator that automatically creates strongly-typed L5Sharp LogixData classes from L5X files.

Overview

L5Sharp.Generators.Data simplifies the process of working with custom User-Defined Types (UDTs) and Add-On Instructions (AOIs) in your C# projects. Instead of manually defining classes to match your Logix data structures, you can include your L5X project file as an AdditionalFiles item in your project. The generator will then produce the corresponding C# classes, complete with automatic registration into the L5Sharp type system.

Features

  • Automatic Type Generation: Generates C# classes for all UDTs and AOIs found in the provided L5X files.
  • Incremental Generation: Optimized for performance using the Roslyn Incremental Generator API.
  • Automatic Registration: Generates a ModuleInitializer to register all produced types with LogixType.Register, ensuring they are available to L5Sharp at runtime.
  • Type Safety: Maps Logix members to their corresponding LogixData or atomic types in C#.
  • Seamless Integration: Works directly with the L5Sharp.Core library.

Installation

Add the L5Sharp.Generators.Data package to your project. Since this is a source generator, it should be added as an analyzer/development dependency.

<ItemGroup>
  <PackageReference Include="L5Sharp.Generators.Data" Version="x.x.x" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
  <PackageReference Include="L5Sharp.Core" Version="x.x.x" />
</ItemGroup>

Usage

  1. Add L5X Files: Add the L5X file containing your type definitions to your project as AdditionalFiles.
<ItemGroup>
  <AdditionalFiles Include="MyLogixProject.L5X" />
</ItemGroup>
  1. Access Generated Types: Once added, the generator will produce classes for each UDT/AOI. You can then use these types just like any other L5Sharp type.
// If you have a UDT named 'MyCustomType' in your L5X.
var myTag = Tag.New<MyCustomType>("SomeTag");
myTag.Value.As<MyCustomType>().SomeMember = 123;
  1. Automatic Registration: You don't need to manually call LogixType.Register. The generator creates a LogixDataRegistration class with a [ModuleInitializer] that handles this for you when the assembly is loaded.

How it Works

The generator scans all AdditionalFiles with an .L5X extension. It parses the DataTypes and AddOnInstructionDefinitions sections to build a model of the types. For each type, it generates a partial class inheriting from StructureData or StringData (depending on the type family), as well as properties for all type members in the definition.

Feedback

If you encounter any issues or have suggestions, please open an issue on the GitHub repository.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.2.0 43 6/4/2026
7.1.0 93 5/25/2026
7.0.0 92 5/24/2026
2.0.0 115 2/18/2026
1.0.0 120 1/19/2026