Simple question, could'nt find a straight answer. How can I modify the output file name of a T4 Template?
I'm using a T4 Template to bundle and minify all my javascript files. Now I want to include the current Assembly Hashcode in my filename. But how can I access this filename?
A workaround would be to rename the ouput file after generating it but this doesnt't seem nice to me.
You need to do something called auto-versioning, and this is usually done by URL rewriting. The physical files are not actually renamed.
See this question for details on javascript and css auto versioning:
How to force browser to reload cached CSS/JS files?
Note that if you use templates to generate a different physical file for every time you generate a file then you will lose a lot of benefits of source control (revisions etc), and you will end up with an unmanageably large set of files on disk.