Incursa.Generators 4.0.0

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

Incursa.Generators

Incursa.Generators is a Roslyn source generator package for creating strongly typed domain models from supported JSON definition files. XML application definitions use the separate deterministic CLI workflow.

For new portable definitions, start with the Generator v2 consumer guide. It covers type-family selection, both backends, build-time versus materialized delivery, capability negotiation, and the boundary between generic generation and external reference data.

Consumers upgrading an existing installation should follow the Generator v2 4.0.0 migration guide.

It is designed for teams that want consistency, type safety, and low-boilerplate patterns for identifiers, enums, and DTO-style models.

What It Generates

  • String-backed value types
  • GUID-backed and FastId-backed identifiers
  • Number-backed and string-backed enums
  • Multi-value types
  • DTO and entity models
  • Generator v2 BCL-only atomic values
  • Generator v2 compact rich catalogs with static typed metadata
  • Generator v2 immutable composite values with canonical encoding

Installation

<ItemGroup>
  <PackageReference Include="Incursa.Generators"
                    Version="x.x.x"
                    IncludeAssets="analyzers;build;buildTransitive;contentFiles"
                    PrivateAssets="all" />
</ItemGroup>

Quick Start

  1. Add definition files (for example *.catalog.json, *.atomic.json, *.string.json, *.enum.json, *.dto.json, *.dto.xml) to your project.
  2. Build your project.
  3. Use the generated .g.cs files as normal domain types.

Example string-backed type definition:

{
  "name": "EmailAddress",
  "namespace": "MyApp.Domain",
  "regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
}

Portable atomic definition:

{
  "schemaVersion": "2.0",
  "family": "atomic",
  "id": "MyApp.Domain.OrderId",
  "storage": "int64",
  "defaultBehavior": "invalid",
  "validation": {
    "minimum": { "kind": "integer", "value": "1" }
  }
}

Configuration

The package also reports IGV1001–IGV1006 for statically detectable generated-value misuse, including invalid defaults, direct construction, unsafe implicit conversions, incomplete catalog switches, missing partial, and simple v1 parsing calls. Compatible IDEs offer semantics-preserving fixes for catalog switches, missing partial, and simple parsing-call migration. Configure severities with normal dotnet_diagnostic.<ID>.severity editorconfig entries.

Optional custom header for generated code:

<PropertyGroup>
  <GeneratedCodeLicenseHeader>// Copyright (c) Your Company</GeneratedCodeLicenseHeader>
</PropertyGroup>

Entity Framework Core ValueConverter source is disabled by default. Projects that reference Entity Framework Core may opt in explicitly:

<PropertyGroup>
  <IncursaGenerateValueConverters>true</IncursaGenerateValueConverters>
</PropertyGroup>

Legacy DTO/entity and FastId-backed definitions are also disabled unless their runtime integrations are explicitly selected:

<PropertyGroup>
  <IncursaEnableFluentValidationIntegration>true</IncursaEnableFluentValidationIntegration>
  <IncursaEnableFastIdIntegration>true</IncursaEnableFastIdIntegration>
</PropertyGroup>

The consumer must reference the corresponding runtime library. Missing opt-in and missing-dependency cases report BG008 and BG009; the generator does not emit source that references an unavailable integration. New definitions should prefer the BCL-only Generator v2 catalog, atomic, and composite families.

The option accepts only true or false (case-insensitive). Any other non-empty value reports BG007 and suppresses affected output. The option is an immutable input to each Roslyn compilation; generator behavior cannot be changed through process-global state.

Generated Type Characteristics

  • Strongly typed and partial
  • Built-in conversion and parsing patterns (where applicable)
  • Validation-aware for supported definitions
  • Clear diagnostics for invalid inputs

Diagnostics

The package emits diagnostics (BG00x) for malformed definitions, duplicate outputs, and generation errors to help identify issues early during build.

Compatibility

  • Generator package target: netstandard2.0 (compiler-host compatibility; this is not a generated-output target promise)
  • Minimum compiler host: .NET 10 SDK / Roslyn 5.0
  • Supported Generator v2 consumer rows: .NET 10 with C# 14 and .NET 11 with C# 15
  • .NET 8 and .NET 9 are not supported v2 rows because both reached end of support on November 10, 2026
  • netstandard2.0, .NET Framework, and other older consumer targets require an explicitly qualified compatibility profile; the generator must not infer support merely because its analyzer assembly targets netstandard2.0
  • Modern APIs are selected from the consumer compilation's available symbols and effective C# language version, not by parsing a target-framework string
  • The generator package has no CommunityToolkit.Diagnostics, Entity Framework Core, FluentValidation, or FastId package dependency. Explicit legacy integrations require the consuming project to reference their runtime library directly.

The complete capability and omission policy is documented in the Generator v2 capability matrix.

Documentation and Samples

Support

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • 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
4.0.0 67 11/30/2026
3.0.0 154 11/29/2026

Breaking Generator v2 release adding portable catalog, atomic, and composite families; deterministic C# and TypeScript/JavaScript backends; materialization and drift checking; analyzers and code fixes; BCL-only core output; and explicit legacy-integration opt-ins. See the v2 migration guide.