Text::Template is a Perl library that allows to generate text from text containing Perl code that is evaluated.
Questions tagged [texttemplate]
43 questions
18
votes
3 answers
How do I pass a string parameter to a t4 template
Hi I am trying to find a way to pass a normal string as a parameter to a text template.
This is my Template code, if someone could tell me what I would need to write in c# to pass my parameters and create the class file. That would be very helpful,…

Toby Jackson
- 183
- 1
- 1
- 4
15
votes
2 answers
Executing a T4 text template in Visual Studio Code
I created a T4 text template (.tt) file in Visual Studio Code, but unlike Visual Studio 2017 (or 2015 ,...) it won't generate the output file after saving the .tt file. How can I generate the output in Visual Studio Code?

theGhostN
- 342
- 7
- 20
13
votes
5 answers
T4 - TT - Using custom classes in TT files
I would like to use my own class define in a CS file in my TT.
Example:
public class ClassDefinition
{
public string NameSpace { get; set; }
public string Name { get; set; }
public string Protection { get; set; }
List…

Eagle
- 421
- 1
- 3
- 9
6
votes
1 answer
T4 and TextTemplatingFileGenerator
I am using T4 in my project.
I have a .tt file which is TextTemplatingFileGenerator
I found that it won't generate the output unless I edit the .tt file.
Is there a way to generate the output by building or compiling?
It is important for me, because…

Ghassan Karwchan
- 3,355
- 7
- 37
- 65
5
votes
1 answer
T4 tool for XCode
Does anything like the T4 text template generation tool of visual studio exist for XCode?
Thanks for help,
Enyra

Enyra
- 17,542
- 12
- 35
- 44
5
votes
2 answers
How can I specify T4 (Text Templates) to use C# 4.0, in VS2010?
I need to specify my T4 to use C# 4.0, to render my tt files? I tried using
<#@ template language="C#v4.0" debug="true" #>
But when I use a dynamic variable, like this
dynamic x=10;
Write(x.ToString());
I'm getting these errors
Error 2 …

amazedsaint
- 7,642
- 7
- 54
- 83
4
votes
1 answer
T4 parameter directive using .Net Core
I have an issue in "CallContext.LogicalGetData" method using .net Core when i try to send parameter to runtime text template t4 (net core)
Below tt file :
<#@ template language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import…

Hm Ch
- 43
- 1
- 8
4
votes
1 answer
Custom Output File Path For T4 Template
I am finding it really difficult to use t4 templates with a non-standard directory structure. I am using links inside my csproj file, which seems to be at the root of the problem.
I have it working, however, VS automatically makes a change which…

sungiant
- 3,152
- 5
- 32
- 49
3
votes
1 answer
T4 Get Execution File Name of Current Solution
I'm using T4 text template to generate a C# class for use in any c# projects.
But, now I need to know the target project execution file name, then to know that config file name and ...
For this job I tried to blow codes, but I think is not stable…

Behzad
- 3,502
- 4
- 36
- 63
3
votes
0 answers
T4 Text Template - generate a part of web.config with tt
I have a big solution with so much WCF services, and my web.config file (in particular the system.servicemodel part) was too big, so i divide the 4 sections of my part in this way

Lorenzo Grossi
- 430
- 1
- 5
- 22
3
votes
1 answer
T4 Text Templating
I have the following .tt file that I wish to use as an include file where I want to expose some properties to the main T4 files:
Include.tt
<#@ assembly name="$(ProjectDir)bin\Debug\EPPlus.dll" #>
<#@ assembly name="System.Configuration.dll" #>
<#@…

Intrepid
- 2,781
- 2
- 29
- 54
3
votes
4 answers
How to generate navigation properties with EntityFramework Reverse POCO Generator?
I was previously using the EF Power Tools which included an option to ReverseEngineerCodeFirst, and in the process of switching to EntityFramework Reverse POCO Generator.
Implementation:
using (var db = new DbContext())
{
…

ElHaix
- 12,846
- 27
- 115
- 203
3
votes
0 answers
Collect attribute property values
I apologize in advance if this gets a little convoluted.
I have an attribute class like so:
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class RepositoryCollectionMethodAttribute : Attribute
{
public string MethodName…

Jeremy Holovacs
- 22,480
- 33
- 117
- 254
2
votes
1 answer
name of class with generic parameters?
I'm trying to generate code for series of generic classes using T4.
I want to know how to get full class name using reflection?
public class Foo {}
var type = typeof(Foo<,>);
var name = type.FullName; // returns "Foo`2"
what I…

M.kazem Akhgary
- 18,645
- 8
- 57
- 118
2
votes
2 answers
Dynamic function injection into Text::Template namespace
I am using the following syntax to inject a function into Text::Template so it knows about that function when using fill_in():
*Text::Template::GEN0::some_function = *SomeLibrary::some_function;
I noticed that if fill_in() is called more than once,…

cgsd
- 1,242
- 2
- 13
- 25