In this blog post I will complete the “template-based card image generator” project that I started a few weeks ago and I will discuss one of my favorite .NET capabilities: compiling C# code at runtime and using the generated types. I will also show how to use Razor templates to generate non-HTML files. The whole process goes through 5 steps: Using Razor to compile a C#/XAML template into the C# code of a code generator class. Using Roslyn to compile the C# generator into an assembly.