Use CodeBuilderContext instead of CodeGeneratorContext.
Use Microsoft.AspNet.Razor.Runtime project.