Skip to content

Getting Started

davidkallesen edited this page Mar 12, 2026 · 1 revision

πŸš€ Getting Started

This guide covers installation, package options, and build requirements for Atc Source Generators.

πŸ“¦ Installation

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.Annotations

Or 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>

πŸ“ About the Annotations Package

The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense.

⚠️ If you include it, suppress the expected CS0436 warning:

<PropertyGroup>
  <NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>

βš™οΈ Build-Time Requirements

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.

πŸš€ Available Generators

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

πŸ”¨ Building & Testing

dotnet build
dotnet test

πŸ“š Next Steps

🏠 Home

πŸ“– Getting Started

⚑ Generators

🎯 Examples

πŸ”— Integrations

πŸ” Reference

πŸ“‹ Feature Roadmaps


πŸ”— Resources

Clone this wiki locally