And*_*rei 7 .net c# t4 templates
问题是:有没有办法在*.tt文件中设置一个设置,以便生成的文件设置为指定的Build Action?
问题是我使用模板生成代码,但它只是一个起点,消除了大量的输入.我不希望任何人按原样使用代码(生成的类),也不希望它混淆命名空间.目前,每次模板添加新文件时,我都必须手动将Build Action设置为None - 我想自动化它.
谢谢!
Dáv*_*nár 1
一个非常简单的解决方法是将生成的代码包装到#if语句中:
#if
#if GENERATED_CODE // my generated code // will compile only if the variable GENERATED_CODE is defined #endif
归档时间:
14 年,6 月 前
查看次数:
564 次
最近记录:
8 年,8 月 前