I am trying to write a nice and structured t4 to generate code. I decompose my logic into reusable functions and put them in separate files (like "regular" code). The problem is that I cannot include the shared file, as it will be included several times.
For example, I have 4 files files: Core.tt , File1.tt , File2.tt and MainTemplate.tt . Core.tt included in both File1.tt and File2.tt . So far, File1.tt and File2.tt are included in MainTemplate.tt
When I want to generate output from MainTemplate.tt , I get the following error:
Error 8 Compiling transformation: The type 'Microsoft.VisualStudio.TextTemplating62CD98C8FF0EB737CAFBD5ED17A158C3.GeneratedTextTransformation' already contains a definition for 'PropertyAttribute'
I think the reason is that Core.tt been enabled twice. Is there a workaround for my problem? In C ++, you can add header protectors: #ifndef xxx #define xxx #endif
source share