Search code examples
namespacescode-generationt4global-namespace

Is it possible to force the underlying class of the T4 runtime template to have no namespace?


I have a T4 runtime template and I would like the underlying class of this template to have no namespace specified (i.e. to be in global namespace).

I know I can set the namespace for the generated class using the Custom Tool Namespace property on the template file, but when leaving this blank, the default namespace is being set according to template location in the project structure. Is there a way how to override this default behavior?


Solution

  • I'm afraid not, no. We always generate a namespace statement, and there is no way to specify the global namespace other than by omission in C#.