How would you test a… C# code generator with Visual Studio Team Test

Introduction I spent some time this week thinking about how to test a code generator that generates C# code and is itself written in C# (so it’s once again all about managed code). At first I thought about how to verify the generator output directly. Since the output is C# code – which ultimately is just…

0

Compiling code at runtime, C# 3.0 and "Compiler executable file csc.exe cannot be found"

Compiling code at runtime is incredibly easy thanks to the CSharpCodeProvider class. But as always, there is a catch. Let’s say you have the following code snippet somewhere in your shiny new VC# 2008 project: CSharpCodeProvider codeProvider = new CSharpCodeProvider(); CompilerResults results = codeProvider.CompileAssemblyFromSource(new CompilerParameters(), @”     public class Foo     {         public int…

0