我同意GarethJ-在VS 2010中,在每个构建上重新生成TT模板要容易得多。奥列格·赛奇的博客描述了如何做到这一点。简言之:安装VisualStudioSDK安装VisualStudio 2010建模和可视化SDK在文本编辑器项目文件中打开并添加到文件末尾,但在此之前</Project>就这样。打开你的项目。在每个构建中,所有*.tt模板都将被重新处理。<!-- This line could already present in file. If it is so just skip it --><Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><!-- process *.tt templates on each build --><PropertyGroup> <TransformOnBuild>true</TransformOnBuild></PropertyGroup><Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets" />