Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T4 Code template trigger generation on: other file save / xml change (VS 2010)

Tags:

c#

.net

t4

I have a t4 template, that loops over an xml file in the project and genrate the code.
Is it possible to make the T4 to run when a certain file has bee saved, or when I build the project?
VS 2010

Thanks

like image 297
SexyMF Avatar asked Nov 13 '22 14:11

SexyMF


1 Answers

  1. Add the XML file to your project
  2. Right Mouse button on your xml file in your project solution explorer and view properties
  3. Excluded from Build should say No
  4. Item Type should say Custom Build Tool
  5. Setup Custom Build Tool Command line and Outputs.

Now whenever the xml file changes (ie newer that its output) it will trigger a build. Rebuilding the project will also trigger a build.

like image 120
parapura rajkumar Avatar answered Dec 15 '22 01:12

parapura rajkumar