Compile SVG into code
Source Generation
Turn artwork into generated drawing code before the application starts.
Explore source ↗Capability
Code generation packages transform SVG assets into strongly referenced Skia drawing code at build time, reducing runtime parsing and asset lookup.
- 01
Build-time SVG processing
- 02
Generated C# drawing code
- 03
Strong asset identity
- 04
No runtime XML parse for generated assets
How it composes
From intent
to working system.
Discover
MSBuild AdditionalFiles identify SVG assets.
Convert
The code generator resolves SVG features into Skia operations.
Emit
The source generator adds typed C# to the compilation.
Draw
Application code invokes the generated picture path directly.
Quick start
Adopt this
capability.
Start with the primary module, then add the related packages only when the application needs those layers. Replace VERSION with the current NuGet version.
dotnet add package Svg.SourceGenerator.Skia<PackageReference Include="Svg.SourceGenerator.Skia" Version="VERSION" /><PackageVersion Include="Svg.SourceGenerator.Skia" Version="VERSION" /><ItemGroup> <AdditionalFiles Include="Assets/**/*.svg" /></ItemGroup>Modules in this capability
Use one layer.
Compose the rest.
Source of truth
Read the module beside the complete system.
The implementation, samples, issues, and release notes stay in the parent repository so module details remain connected to the product architecture.