Question

We have several projects that use runtime T4 Templates. The T4 Template files (.tt) produce generated .cs files with the same name. These contain a TransformText() method and a ToStringHelper() method which do not contain XML comments. We generate XML documentation for all of our projects, so the lack of it on these two methods causes persistent warnings during compilation.

My question is, does anyone know how to get these two generated methods to have XML documentation?

Thanks for any responses.

EDIT: To clarify, I'm using .NET 4.0 with Visual Studio SP1. The TransformText() and ToStringHelper() are boilerplate T4 methods that I cannot modify through the .tt file.

Was it helpful?

Solution

There's no way to change this directly in T4. It's fixed in the next version of Visual Studio. You could imagine a regex based search/replace to insert the comments added as a pre-build event.

Alternatively you could embed that post-processing in a new SingleFileGenerator derived from Microsoft.VisualStudio.TextTemplating.VSHost.TemplatedPreprocessor, but that seems a bit like overkill.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top