I have made a simple design-time template that uses an enum that resides in the same project. The template cranks out a class definition for each variable in that enum type.
I noticed that changing and saving the .tt file in anyway makes it crank out the c# code again. I am hoping that I can set the solution up so that if I change the enum and then save, then the template might also crank out the source again.. That way when I want to add a new type, I could add a variable to the enum definition and maybe just press save.
At the moment I have to do this:
- Add variable to the enum definition in its .cs file.
- Re-compile the project.
- Go "run custom tool" on the template .tt file.
- then need to compile again to compile-in the t4-generated source.
So, maybe there is a way to get the template to "detect" a change in another source with that it uses, and to act like it has been modified itself?