T4模板TransformText方法XML文档 [英] T4 Template TransformText method XML Documentation

查看:619
本文介绍了T4模板TransformText方法XML文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须使用运行时T4模板几个项目。 T4的模板文件(.TT)产生产生的.cs具有相同名称的文件。这些包含 TransformText()方法和不包含XML注释的 ToStringHelper()方法。我们生成XML文档,我们所有的项目,所以这两种方法缺少了它在编译过程中会导致持久性的警告。

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.

我的问题是,没有人知道如何得到这两种产生方式对XML文档?

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

感谢您的任何答复。

编辑:为了澄清,我使用.NET 4.0与Visual Studio SP1。该TransformText()和ToStringHelper()是样板T4的方法,我无法通过.TT文件修改。

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.

推荐答案

有没有办法直接在T4改变这一点。它是固定在Visual Studio的下一个版本。你可以想像一个基于正则表达式查找/替换插入添加为pre-build事件的评论。

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.

另外,您可以嵌入在从Microsoft.VisualStudio.TextTemplating.VSHost.Templated preprocessor派生的新SingleFileGenerator的后处理,但是,似乎有点像杀鸡用牛刀。

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.

这篇关于T4模板TransformText方法XML文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆