1

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.

4
  • What is stopping you from generating XML comments from your T4 templates? the template just outputs characters, so doesn't care whether it is code or comments. Commented Feb 7, 2012 at 15:57
  • Are you on Service Pack 1 ov Visual Studio 2010? I think I fixed this in SP1. Commented Feb 7, 2012 at 16:59
  • @GarethJ - Yes I am. We use .NET 4.0 with Visual Studio SP1. Commented Feb 7, 2012 at 17:23
  • Sadly you're right, my memory is playing tricks on me. I didn't fix this until we started Visual Studio vNext. Commented Feb 8, 2012 at 17:27

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the information. Glad to hear this is fixed in the upcoming version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.