L5Sharp.Generators 7.2.0

dotnet add package L5Sharp.Generators --version 7.2.0
                    
NuGet\Install-Package L5Sharp.Generators -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" 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" Version="7.2.0" />
                    
Directory.Packages.props
<PackageReference Include="L5Sharp.Generators" />
                    
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 --version 7.2.0
                    
#r "nuget: L5Sharp.Generators, 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@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&version=7.2.0
                    
Install as a Cake Addin
#tool nuget:?package=L5Sharp.Generators&version=7.2.0
                    
Install as a Cake Tool

L5Sharp.Generators

A collection of Roslyn incremental source generators for the L5Sharp library.

Overview

L5Sharp.Generators provides source generators that perform automatic type registration with the static LogixSerializer and LogixType classes. This allows the core library to avoid using reflection or manual registration code which allow these types to be deserialized from L5X content.

This library is primarily used by L5Sharp.Core. Developers should not need to reference this project unless they intend to create custom types that implement LogixElement or LogixData. If you want to auto generic custom UDT types from a given L5X, use L5Sharp.Generators.Data, which will build classes for all DataType and AddOnInstructions found in the file.

Generators

LogixSerializerRegistrationGenerator

Automatically discovers and registers types decorated with the [LogixElement] attribute. This allows L5Sharp to register these types in the LogixSerializer class without manual configuration or use of reflection.

LogixTypeRegistrationGenerator

Automatically discovers and registers classes decorated with the [LogixData] attribute. This ensures that L5Sharp knows how to instantiate predefined or custom LogixData types to populate tag data in memory.

ModuleInitializerGenerator

A utility generator that adds the [ModuleInitializer] attribute polyfill for libraries targeting frameworks below .NET 5, enabling the use of module initializers to call the registration methods as soon as the assembly is loaded.

Installation

Add the L5Sharp.Generators package to your project as an analyzer/development dependency.


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

Usage

For LogixTypeRegistrationGenerator, decorate your custom classes with the LogixData attribute:

[LogixData("MyCustomType")]
public class MyCustomType : StructureData
{
    // ...
}

The generator will automatically produce the registration code:

LogixType.Register<MyCustomType>("MyCustomType");

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 40 6/4/2026
7.1.0 91 5/25/2026
7.0.0 91 5/24/2026
1.1.1 117 2/18/2026
1.1.0 121 12/31/2025
1.0.0 130 12/12/2025