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

后端 未结 4 1067
甜味超标
甜味超标 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:09

    You can use AutoTT Visual Studio Extension.

    This extension allows to configure triggers that will run a T4 template.

    One of the possible triggers is a file change. In the sample configuration file in AutoTT page, the regular expression for the triggers matches all files in the specified folders (Controllers, Content), but you can change it so that it runs with a specific file only.

    Chirpy is another option for doing this. And also T4 Regenerator, which does it in a different way.

提交回复
热议问题