How to add a dependency to a arbitrary file to a T4 template?

后端 未结 4 1082
甜味超标
甜味超标 2021-01-02 11:35

I have a T4 template that generates classes from an xml file.

How can I add a dependency between the xml file and the template file so that when the xml file is mod

4条回答
  •  余生分开走
    2021-01-02 12:16

    I don't believe T4 supports automatic template transformation based on an external dependency. I agree with Marc - if you only have one external file, you could create a custom "custom tool" for your XML file or simply use ttxgen. However, I don't think this approach scales up to a scenario where t4 template depends on more than one file. You may need to create a Visual Studio package to handle that.

提交回复
热议问题