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
<PackageReference Include="Incursa.Generators" Version="4.0.0" />
<PackageVersion Include="Incursa.Generators" Version="4.0.0" />
<PackageReference Include="Incursa.Generators" />
paket add Incursa.Generators --version 4.0.0
#r "nuget: Incursa.Generators, 4.0.0"
#:package Incursa.Generators@4.0.0
#addin nuget:?package=Incursa.Generators&version=4.0.0
#tool nuget:?package=Incursa.Generators&version=4.0.0
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
- Add definition files (for example
*.catalog.json,*.atomic.json,*.string.json,*.enum.json,*.dto.json,*.dto.xml) to your project. - Build your project.
- Use the generated
.g.csfiles 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 targetsnetstandard2.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
- Repository docs and schema references: https://github.com/incursa/generators/tree/main/docs
- Catalog-backed string enums: https://github.com/incursa/generators/blob/main/docs/string-backed-enum-catalogs.md
- Generator v2 rich catalog behavior: https://github.com/incursa/generators/blob/main/docs/architecture/generator-v2-rich-catalog-behavior.md
- Immutable generator options: https://github.com/incursa/generators/blob/main/docs/architecture/generator-options.md
- Generator v2 atomic values: https://github.com/incursa/generators/blob/main/docs/atomic-values.md
- Generator v2 composite values: https://github.com/incursa/generators/blob/main/docs/composite-values.md
- Retired and unsupported surfaces: https://github.com/incursa/generators/blob/main/docs/guides/retired-generator-surfaces.md
- Sample inputs: https://github.com/incursa/generators/tree/main/examples
Support
- Open an issue: https://github.com/incursa/generators/issues
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.
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.