Can't get t4 "run on build" to work

Feb 24, 2012 at 8:53 AM
Edited Feb 24, 2012 at 12:06 PM

The T4 template 'Run on build' feature would be great for us but I can't get it to work.

I have checked the 'Run on Build' checkbox in the Chirpy options Dialog, but when I build my project in VS the files are not generated.

Do I have to enter anything in the  'Template:' text box?


Developer
Feb 26, 2012 at 6:26 PM

Do I have to enter anything in the  'Template:' text box?

Enter your t4 template file.

Sample : t4mvc.tt, NHibernate.tt

http://www.weirdlover.com/2010/07/18/chirpy-attains-godlike-abilities-in-version-1-0-0-4/#autorun

Feb 27, 2012 at 7:52 AM
Edited Feb 27, 2012 at 11:29 AM

I now found out that I need to enter either the absolute path of the tt file or the relative path from the solution folder (my tt file is in a sub-folder of the solution folder). If Chirpy does not find the tt file there is no warning or error message.

But I still have a problem, I get a 'System.UnauthorizedAccessException' error when I build. e.g. Access to the path 'C:\Code\search\myTemplate.tt' is denied.

This is because the tt file is not checked out and it is read-only. We are using TFS.

This makes it unusable for our requirements - we don't want to check out the tt file. The tt file does not change often, but the source model that the tt file uses to generate code changes regularly.