Skip to content

Development Environment

This appendix provides a quick reference for the environment required for source generator development. Use it when reconstructing the environment after completing the main tutorial. For detailed explanations of each item, refer to Part 1-01. Development Environment Setup.


ToolMinimum VersionPurpose
.NET SDK10.0Source generator build and test
Visual Studio 202217.12+IDE (source generator debugging support)
VS Code + C# Dev KitLatestAlternative IDE
Terminal window
# Verify installation
dotnet --version
# Example output: 10.0.100

PackagePurpose
Microsoft.CodeAnalysis.CSharpRoslyn C# compiler API (Syntax, Semantic)
Microsoft.CodeAnalysis.AnalyzersAnalyzer development rule validation

Both packages should specify PrivateAssets="all" to prevent transitive dependency to consumer projects.


PropertyValueDescription
TargetFrameworknetstandard2.0Required target for compatibility across all IDE/CLI environments
IsRoslynComponenttrueRecognized as a source generator component
EnforceExtendedAnalyzerRulestrueEnforces analyzer packaging rules
IncludeBuildOutputfalseExcludes build output from NuGet package distribution

Production Project (using source generator)

Section titled “Production Project (using source generator)”
<ProjectReference Include="..\MySourceGenerator\MySourceGenerator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
PropertyDescription
OutputItemType="Analyzer"Recognized as an analyzer/generator
ReferenceOutputAssembly="false"Excludes runtime reference (compile-time only)
<ProjectReference Include="..\MySourceGenerator\MySourceGenerator.csproj"
ReferenceOutputAssembly="true" />

In test projects, set ReferenceOutputAssembly="true" to allow the debugger to step into the source generator internals.


Part 1-01. Development Environment Setup