Using T4 I want to generate some code based on examining what files are in a directory relative to the template file being executed.
Is there a way in c# to identify what the path of the current template file is?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
hostspecific="true"property of the<#@ templatedirective toTrue.Host, which gives you access toResolvePathmethod andTemplateFileproperty.Hostis of typeITextTemplatingEngineHost.TemplateFileis aStringvalue which is typically the file-system path of the.ttfile – however other T4 hosts (i.e. hosts other than Visual Studio) which may load a T4 file in-memory or otherwise may return some other value as the template file doesn’t exist on-disk.For example: