有没有办法让Visual Studio的运行和QUOT;把所有的模板"在成功构建?有的、没有办法、模板、Studio

2023-09-04 02:54:25 作者:悲歌长辞

我有geneates基于这是我的项目中声明的其他code helpert code T4模板。正因为如此,我必须建立我的项目之前,我运行转换所有模板。是否有可能有转换所有模板编译成功后运行作为一个生成后事件?

I have a T4 template that geneates helpert code based on other code that is declared within my project. Because of this, I have to build my project before I run "Transform All Templates". Is it possible to have "Transform All Templates" run as a post-build-event upon a successful build?

推荐答案

一个简单的解决方案可能是修改模板洛杉矶的 T4 MVC 模板,以便它们自动标记自己作为构建脏(查看文档页面并搜索AlwaysKeepTemplateDirty了解详细信息)。你也许可以编辑自己的模板,让他们做同样的事情。

An easier solution may be to modify your templates A LA the T4 MVC templates so that they automatically mark themselves as dirty on build (check the docs page and search for AlwaysKeepTemplateDirty for details). You could probably edit your templates to have them do the same thing.