I have T4 template (mycode.tt) which generates a cs file. I usually right click the tt file and select RunCustomTool which internally takes an xml file and generate code for me.
I'd recommend the preprocessed route as answered above by @jb_.
As an alternative, if you need your templates to still be editable without a compile step for use with your custom C# application, and the application will only be deployed on machines alongside Visual Studio, you can write a custom host.
http://msdn.microsoft.com/en-us/library/bb126519.aspx