How can i use generated file's name in template? I'd like to something like this:
// This file: <#= OutputFileName #> was autogenerated
How can i do that in T4 or in T4Toolbox?
How can i use generated file's name in template? I'd like to something like this:
// This file: <#= OutputFileName #> was autogenerated
How can i do that in T4 or in T4Toolbox?
This seemed like something that should be as simple as reading a property but after reflecting over the Host variable and disassembling the text generator code I think the simplest way of doing this is:
<#@ template language="C#" hostspecific="true" #>
<#@ import namespace="System.IO" #>
// <#=Path.ChangeExtension (Host.TemplateFile, "cs")#>
It better to define it as a directive
for example for a xaml file
<#@ output extension="xaml" #>
or for txt
<#@ output extension=".txt" #>
© 2022 - 2024 — McMap. All rights reserved.