Repository navigation
Getting Started
This guide covers installation, package options, and build requirements for Atc Source Generators.
All generators are distributed in a single NuGet package. Install once to use all features.
β Required:
dotnet add package Atc.SourceGeneratorsπ‘ Optional (recommended for better IntelliSense):
dotnet add package Atc.SourceGenerators.AnnotationsOr in your .csproj:
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />
<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense.
<PropertyGroup>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>This package uses Roslyn 5.0.0 (.NET 10) for source generation. To build projects that consume this package:
β Required:
- π οΈ .NET 10 SDK (or later)
π Important Notes:
- β Projects targeting .NET 9 (or earlier) CAN successfully build using the .NET 10 SDK
- π‘ This is a build-time requirement only, not a runtime requirement
- π― Your application can still target and run on .NET 9, .NET 8, or earlier framework versions
- βοΈ The SDK version only affects the build process, not the target framework or runtime
Example:
# Install .NET 10 SDK
# Download from: https://dotnet.microsoft.com/download/dotnet/10.0
# Your project can still target .NET 9
<TargetFramework>net9.0</TargetFramework>
# But requires .NET 10 SDK to build (due to Roslyn 5.0.0 source generator dependency)
dotnet build # Must use .NET 10 SDKπ€ Why .NET 10 SDK?
The source generators in this package leverage Roslyn 5.0.0 APIs which ship with .NET 10. While your consuming applications can target any .NET version (including .NET 9, .NET 8, or .NET Framework), the build toolchain requires .NET 10 SDK for proper source generator execution.
Once installed, you have access to all five generators:
| Generator | Attribute | Guide |
|---|---|---|
| π DependencyRegistration | [Registration] |
Working with Dependency Registration |
| βοΈ OptionsBinding | [OptionsBinding] |
Working with Options Binding |
| πΊοΈ ObjectMapping | [MapTo(typeof(Target))] |
Working with Object Mapping |
| π EnumMapping | [MapTo(typeof(TargetEnum))] |
Working with Enum Mapping |
| π AnnotationConstants | (automatic) | Working with Annotation Constants |
dotnet build
dotnet test- π» Explore the Sample Projects for working code examples
- πΎ See the PetStore API Example for a complete application using all generators together
π Home
- π Getting Started
- π Migration Guide
- π Working with Dependency Registration
- βοΈ Working with Options Binding
- πΊοΈ Working with Object Mapping
- π Working with Enum Mapping
- π Working with Annotation Constants
- π¦ Sample Projects
- πΎ PetStore API Example
- π Attribute API Reference
- π©Ί Diagnostics Reference
β οΈ Common Patterns and Anti-Patterns- π Native AOT Compatibility
- π§ Troubleshooting
- π Dependency Registration Feature Roadmap
- βοΈ Options Binding Feature Roadmap
- πΊοΈ Object Mapping Feature Roadmap
- π Annotation Constants Feature Roadmap
- π¦ GitHub Repository
- π₯ NuGet Package
- π Report Issues