I'm generating quite a bit of code from a single XML file, but the templates are organized in two different T4 templates. Whenever I change the XML file, I have to remember to open the two
*.tt files, change them trivially (add / delete a space) and save them again to make sure the code is generated.
This can't be the right way to do it!
Ideally, I would like Visual Studio 2008 to do a text transfor on the T4 files if the XML file has changed. I'm a bit lost since I don't really know how Visual Studio builds C# projects, so pointers in that direction would also be of help (I could then try to figure it out myself).
You can use T4ScriptFileGenerator from T4Toolbox as a custom tool for your XML file. Let's say you have Test.XML file in your project with this custom tool. The first time Test.XML is saved, this custom tool create a new Test.tt file. You can place your code generation logic there (in place, or #include your other .tt files). Next time you save Test.XML it will transform (generate code from) the existing Test.tt.