T4变革和建立在Visual Studio中为了 [英] T4 transformation and build order in Visual Studio

查看:177
本文介绍了T4变革和建立在Visual Studio中为了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含VS项目:
在template.tt运行TextTransform产生generated.cs
2.generated.cs的1.预生成作用列为其中一个文件汇编(即项目文件的列表

I have a VS project that contains: 1. A Pre-Build action of running TextTransform on a "template.tt" to generate "generated.cs" 2. "generated.cs" listed as one of the files to compile (i.e. in the list of project files

当我生成项目,生成预动作完成后,generated.cs是重新创建,但VS编译它的前一版本(我猜它加载到内存的生成过程的开始)。

When I build the project, the pre-build action is done, "generated.cs" is re-created but VS compiles the previous version of it (that I guess it loaded to memory at start of the build process).

有什么可以做,以使构建将使用newlly生成的CS文件(即在构建诉讼前产生的?

What can be done so that the build will use the newlly generated cs file (that is generated in the pre-build action?

(注意,在我的处境文本转换输入是动态的,因此无法做到的在设计时)

(note that in my situation the text transformation input is dynamic hence cannot be done in design time)

感谢。

推荐答案

我不知道想你需要一个自定义的预构建的行动。就在.TT文件添加到您的项目,并设置它的自定义工具属性设置为TextTemplatingFileGenerator你可能希望确保* .generated.cs文件也添加到项目中,但我认为VS需要照顾的。

I don't think you need a custom pre-build action. Just add the ".tt" file to your project and set its "Custom Tool" property to "TextTemplatingFileGenerator". You might want to make sure that the *.generated.cs files are also added to the project, but I think that VS takes care of that.

这篇关于T4变革和建立在Visual Studio中为了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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