在CodeSmith中使用CodeTemplateInfo可以获取当前模版的一些信息:
|
属性 |
返回值 |
|
CodeBehind |
Gets the full path to the code-behind file for the template (or an empty string if there is no code-behind file). |
|
ContentHashCode |
Gets the hash code based on the template content and all template dependencies. |
|
DateCreated |
Gets the date the template was created. |
|
DateModified |
Gets the date the template was modified. |
|
Description |
Gets the description. |
|
DirectoryName |
Gets the name of the directory the template is located in. |
|
FileName |
Gets the name of the template file. |
|
FullPath |
Gets the full path to the template. |
|
Language |
Gets the template language. |
|
TargetLanguage |
Gets the target language. |
看一下一个具体的使用例子:
执行该模版输出如下(环境不同,输出也不同):