5

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

SexyMF
  • 10,657
  • 33
  • 102
  • 206
  • 1
    Check http://stackoverflow.com/questions/1646580/get-visual-studio-to-run-a-t4-template-on-every-build/3381556#3381556 for enabling tranformation at build time in VS 2010. – João Angelo Nov 07 '11 at 13:03

2 Answers2

1
  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.

parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
0

Dynamo.AutoTT will do what you need. You can configure it to watch files via a regex, and specify which T4 templates you want it to trigger.

You can download it from here : https://github.com/MartinF/Dynamo.AutoTT

Just build it, copy the dll and AddIn files into

C:\Users\\Documents\Visual Studio 2012\Addins\

and away you go.

If you want to get it going in VS2012 you will need to modify the a Dynamo.AutoTT.AddIn file and set the Version to 11.0 inside the AddIn file;

Matware
  • 104
  • 5