Unio.SourceGenerator
1.2.1
Requires NuGet 2.12 or higher.
dotnet add package Unio.SourceGenerator --version 1.2.1
NuGet\Install-Package Unio.SourceGenerator -Version 1.2.1
<PackageReference Include="Unio.SourceGenerator" Version="1.2.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Unio.SourceGenerator" Version="1.2.1" />
<PackageReference Include="Unio.SourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Unio.SourceGenerator --version 1.2.1
#r "nuget: Unio.SourceGenerator, 1.2.1"
#:package Unio.SourceGenerator@1.2.1
#addin nuget:?package=Unio.SourceGenerator&version=1.2.1
#tool nuget:?package=Unio.SourceGenerator&version=1.2.1
Unio.SourceGenerator
Roslyn incremental source generator for Unio discriminated unions.
Generates named, strongly-typed union wrappers from a simple declaration:
using Unio;
[GenerateUnio]
public partial class StringOrInt : UnioBase<string, int>;
The generator adds constructors, implicit conversions and typed equality to a sealed partial class. The union API is inherited from UnioBase<...>.
Use a top-level, non-generic partial class with 2–20 distinct branch types. Nested, generic, abstract, static and file-local classes receive UNIO005; missing partial receives UNIO006. Duplicate branch types receive UNIO003 as an error.
Native AOT and requirements
The generated code supports Native AOT and trimming without runtime reflection or dynamic code. The generator itself runs inside Roslyn at build time and is packaged only as an analyzer; it is not a runtime dependency and does not need IsAotCompatible.
The analyzer targets netstandard2.0 for compiler-host compatibility and requires a Roslyn 5.0-compatible compiler (.NET 10 SDK or newer). This does not add older .NET runtime support: the Unio runtime packages target .NET 9, .NET 10 and .NET 11 RC1.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Unio.SourceGenerator:
| Package | Downloads |
|---|---|
|
Tlib.Union
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.