Assume I have a project (say ProjectA) with a number of C# classes and that those classes do not reference any types outside of the project and that of the System.dll assembly. The classes in ProjectA may have methods, properties, fields and custom properties. Classes may also exist within different namespaces.
How would one go about using T4 to transform all those classes, including methods, properties, fields and custom attributes, from ProjectA, to a related set in another project (say ProjectB).
Werner, you can certainly do this. A good technique is to use VS's Code Model. There's some pointers to examples here: http://blogs.msdn.com/b/garethj/archive/2009/09/25/dte-and-t4-better-together.aspx
You'd use code model to read the classes in as metadata without compiling and then generate using that metadata as input. You might want to then look at Oleg Sych's T4 Toolbox ( http://t4toolbox.codeplex.com ) to project the ouput into the secondary project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With