t4 Questions

2

Solved

I've beat my head against the wall for a couple of days on this one. No amount of Googling or messing around seems to yield the answer. I want to run a T4 template at build time. In it, I need to ...
Joslin asked 9/6, 2014 at 21:39

2

I want to have a T4 template in a Visual Studio item template, but I don't want the "tt" file to appear in the project after the item has been added. In short, I want to generate a .cs file and the...
Malar asked 27/4, 2014 at 14:22

1

Solved

I am using a T4 template to (among other things) increment build numbers in the AssemblyInfo.cs file. As I only want the transformation to occur when I run a Release build, I have previously done...
Brocade asked 23/3, 2017 at 17:5

6

Solved

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 Prot...
Cantone asked 25/7, 2014 at 14:10

2

Solved

Is it possible to define a new class within a t4 template? I tried this but it gave me an error: 'A template containing a class feature must end with a class feature' <#+ public class AppSett...
t4
Biltong asked 5/2, 2014 at 11:11

24

Solved

How do I get a T4 template to generate its output on every build? As it is now, it only regenerates it when I make a change to the template. I have found other questions similar to this: T4 trans...
Broucek asked 29/10, 2009 at 21:14

4

Solved

I have an extension I'm updating from VS2019 to VS2022. It's a DSL using the Modeling SDK and has code generation via T4 templates. I have it pretty much converted but, when running the T4s, I get ...
Beaut asked 15/11, 2021 at 13:17

3

In VS2017 Community, I cannot debug T4 Templates, which works in 2015. I have a very basic template, such as this... <#@ template debug="true" hostspecific="false" language="C#" #> <#@ o...
Batiste asked 3/4, 2017 at 12:11

5

I have recently migrated a test project to .NET Core 2.0. That test project used text templates to generate some repetitive code. The previous project had a build target to generate all T4-template...
Rational asked 7/12, 2017 at 9:6

3

Solved

I am attempting to generate code using T4 Text Templating, but when running the script, I get the error below: Running transformation: System.NullReferenceException: Object reference not set to an...
Twelvemo asked 24/7, 2012 at 18:54

3

Solved

This started with an EDMX suddenly not generating class files. The .context.cs file contains the class declaration like public virtual DbSet<myTable> myTable { get; set; } but the act...
Zoochore asked 28/5, 2023 at 22:15

8

Solved

Is there any way to tell Visual Studio 2010 to enable syntax highlighting for .tt files? I do have a directive to set the extension: <#@ output extension=".ascx" #> So I'd like Visual Stud...
Periodontal asked 4/4, 2011 at 22:29

3

I'm attempting to create some scaffolding for CRUD classes and would like use T4 to assist in building these classes. I'm just getting started and having an issue calling a class that lives in the ...
Farland asked 4/3, 2014 at 20:34

4

Solved

Attempting to run the T4 templates for Immutable Object Graph gives errors of ╔═══════╦═══╦══════════════════════════════════════════════════════════════════════════════════════════════════╦═════...
Crescantia asked 24/4, 2014 at 23:5

2

Solved

In my VS2010 solution I have set of Powershell scripts and T4 templates based on T4Scaffolding NuGet, everything is working fine with scaffolding and related T4's, but in one of my scripts I need t...
Rotorua asked 9/2, 2012 at 19:5

4

I'm using T4 for code generation. Its working well but one thing I'd like to do is some simple logging, I'm happy if this simply took the form of throwing messages into the Output window. Does any...
Urbana asked 3/10, 2014 at 7:10

4

Solved

I work with a bunch of something.js.tt JavaScript files using Knockout and a bunch of something-else.tt HTML files. The infrastructure is mostly a C backend with Perl serving API and we use these ...
Willettewilley asked 5/1, 2016 at 21:17

1

Solved

Using VS2022 17.2.0 Preview 2.0 to generate data layer using T4 templates. Part of the T4 uses VS interop / DTE to access projects in solution. The following T4 is a test: <#@ template debug=&qu...
Kiruna asked 22/3, 2022 at 16:10

2

Solved

I'm trying to build a template that will create a series of files in different folders but I haven't found any samples.
Shearer asked 17/4, 2012 at 10:41

1

Constraints are: Using Visual Studio 2017. Needs to ultimately be called from a powershell script calling MSBuild. Not sure its relevant, but needs to be able to build the following: asp.net 461...
Hughie asked 21/11, 2017 at 19:53

4

Solved

Where is TextTransform.exe located? I'm trying to implement the solution in this post: Get Visual Studio to run a T4 Template on every build However I'm getting an error "'TextTransform.exe' is...
t4
Swords asked 26/7, 2010 at 16:9

2

I'm in desperate need to generate HTML output with T4 in C#. I'm using Runtime-T4-Files and chose as option "TextTemplatingFilePreprocessor" instead of "TextTemplatingFileGenerator&q...
Mispleading asked 29/5, 2021 at 12:56

4

Solved

I'm trying to run a new T4 template in Visual Studio 2015. However it fails to compile at this line: var message = $"Linked table '{linkedTable}' does not exist."; The compiler reports that the ...
Coactive asked 10/9, 2015 at 14:52

0

I'm generating a static class with constants from an XML file using T4 text templates. The template shall be transformed with every build so I added the following statements in the .csproj: <Imp...
Petite asked 22/6, 2021 at 6:16

3

Solved

Why do my T4 templates sometimes append a number to the output file and sometimes not? For instance, in one case I might have a template file called Foo.tt and I'll get an output file of Foo.cs. In...
Connacht asked 21/12, 2009 at 21:50

© 2022 - 2024 — McMap. All rights reserved.