Hey
I am new with T4 (Text Template). I have played around and I have done my first .tt file.
It works pretty fine. - There is just an issue, that file is always generated underneath the .tt file.
I googled around and found the T4 Toolbox tool, which I installed. - But I don't get it working anyway.
Maybe there is somebody, who can help me, because the T4 Toolbox Discussion on codeplex seems to be dead...
OK: Here is my Template:
<#@ template debug="true" hostspecific="true" language="VB" #>
<#@ include file="T4Toolbox.tt" #>
<#@ output extension=".vb" #>
<#@ assembly name="System.Windows.Forms" #>
<#@ import namespace="System.Resources" #>
<#@ import namespace="System.Collections" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.ComponentModel.Design" #>
<#
Dim myNameSpace As String = "Customer"
Dim myClassName As String = "GetCustomer"
Dim myTypeOfResourceManager As String = "TypeOfResourceManager.Customer"
Dim myResourcePath As String = "Resources\de-AT\Customer"
Dim myFileName As String = "Customer.de-AT.resx"
Dim myFilePath As String = Path.Combine(Path.GetDirectoryName(Me.Host.ResolvePath("")), myResourcePath, myFileName)
Dim myReader= New ResXResourceReader(myFilePath)
myreader.UseResXDataNodes = true
Dim myDateTime As String = Date.Now.ToString
#>
Namespace <#=myNameSpace #>
Public Class <#=myClassName #>
Inherits Localize.Localization
Public Sub New()
MyBase.New(<#= myTypeOfResourceManager #>)
End Sub
<# For each item As DictionaryEntry In myReader
Dim name = item.Key
Dim node = DirectCast(item.Value, ResXDataNode)
Dim comment = node.Comment
Dim summary As String = String.Empty
If Not [String].IsNullOrEmpty(comment) Then
summary += comment
End If
#>
''' <summary>
''' <#= summary #>
''' </summary>
''' <remarks></remarks>
Public ReadOnly Property Get<#= name #> As String
Get
Return MyBase.GetLocalizedString("<#= name #>")
End Get
End Property
<#
Next
#>
End Class
End NameSpace
As I understood the T4 Toolbox, I have to create a .tt file, which should work as class. - > But I don't get it working anyhow.
Please help - THX