t4

Can't use code generators because of "object reference not set to an instance of..."

What can cause this behaviour? I'm trying to generate code via ADO.NET EntityObject/Poco/SelfTracking Generator and i get only "object reference not set to an instance of an object" error I can add i'm using EF4 with OracleProvider and previously i've generated code with EdmGen2, but right now i'd like to generate POCO classes from exi...

T4 template for Ruby or Java

I am using T4 for generating code. With Visual Studio I could generate code in C# or VB. What is required for generating code in Ruby or Java ? I have a some utility classes that is required in multiple language (C#, Ruby and Java). I am looking for defining T4 templates... Thanks ...

T4 Toolbox - Referencing Class in Current Assembly

Can anyone help me - I need to reference a class in one of my T4 Toolbox scripts that resides in the same assembly as the script. Basically I want to reflect over certain classes and do some code generation on them. The problem is that nothing gets generated and I get errors telling me the class in my current project cannot be accessed....

How can I permanently forget T4 generated files from being version control using Mercurial?

How can I permanently forget T4 generated files from being version control using Mercurial? It seems that Visual Studio (VisualHG) automatically adding them to version control. ...

Does VS 2010 Express edition support T4 preprocessed templates?

Just installed 2010 Express Edition and I cannot see Preprocess t4 template as an option. Is it not supported in 2010 Express? ...

How to use VB `option` statements (explicit/infer/strict) in T4 templates?

When creating a T4 template in VB.NET, how do you specify Option Explicit, Option Strict, and Option Infer settings? There's some sort of <#@ #> tag for doing this, but I can't find it. ...

Adding my template to the list of code generation items in Studio 2010

I have taken the POCO tt templates that can be used in Studio 2010 with Entity Framework and modified them to better fit my needs. I have added a few things to make testing easier. Now I want to be able to right click on the entity framework design surface, choose "Add Code Generation Item" and select my templates instead of the built ...

Adding Include Files to the Add Controller T4 Templates in ASP.NET MVC

Hi, is it possible to add include files within my custom t4 templates for the "Add Controller" dialog box? I have tried doing: <#@ include file="Helpers.tt" #> This is what you would typically do in t4 but this does not seem to work. Currently i have resorted to throwing all my helper functions in the footer of my templates but this...

Where is TextTransform.exe Located on Hard drive?

Where is TextTransform.exe located? I'm trying to implement the solution in this post: http://stackoverflow.com/questions/1646580/get-visual-studio-to-run-a-t4-template-on-every-build However I'm getting an error "'TextTransform.exe' is not recognized as an internal or external command, operable program or batch file." I have been l...

Can CodeDom add Source Code Files to a Project?

I have been using CodeDom to do some code generation. It works great, but I haven't found a way to include the generated source code files in a project. I started using T4 and the T4Toolbox to generate code because it supports integration with project files. Does anyone know if CodeDom supports this functionality too? I'd consider taki...

T4 code generation without Visual Studio 2010?

Is it possible to run T4 code generation without needing Visual Studio 2010? Basically I have to build an in house ORM (don't ask..if I had a choice I wouldn't). I was planning to use subsonic as a base but change some things and how they work. However my main question is can I run T4 from an external application that I write, so I can u...

VsAddin or T4 for code generation (VS 2008)

I have build an Addin for code generation (C#, VS 08) for our team. The addin creates a new menu entry if i click on a file in the solution explorer. There i can choose a destination test project where the 2 files are generated to. For the code generation process i need informations from the selected item in the solution explorer (like...

Mono refuses to resolve relative paths in T4 template includes

Ok so I'm trying to hack together something to make SubSonic3 work with Postgres, on Mono. I almost have the templates generating but have ran into one small problem. <#@ include file="PostgreSQL.ttinclude" #> will give a "cannot resolve include file" error. However, specifying a full path will work(though cumbersome) <#@ include...

What is the difference between <# and <#+ in T4?

What is the difference between the <# tag and the <#+ tag in T4? ...

Creating T4 template file referring SubSonic

I am trying to write T4 template to create wrapper classes for classes created by SubSonic 3 (implementing IActiveRecord). But when I compile my template I get following error: Compiling transformation: Metadata file 'SubSonic.Core' could not be found I'm including SubSonic.Core in my settings file. <#@ assembly name="SubSonic.Core" #...

Using types in a T4 tempate that exist in the same project as the template

I'm working on my first T4 code generation tool to add some Stored Procedure helper code to my project. I've created custom types (e.g. StoredProcedure and StoredProcedureParameter to help with my code generation and have included the assembly and namespace references in my code: <#@ template debug="false" hostspecific="false" language...

Is there a way to get Visual Studio to run "Transform All Templates" upon a successful build?

I have a T4 template that geneates helpert code based on other code that is declared within my project. Because of this, I have to build my project before I run "Transform All Templates". Is it possible to have "Transform All Templates" run as a post-build-event upon a successful build? ...

Trouble understanding T4

I've just started playing with T4, as I eventually want to use it to generate POCO's that map to LINQ to SQL entity classes, but even the simplest example has me slightly confused. Some advice on what is happening, and some advice on some good reading would be greatly appreciated. I am of the understanding that the following template s...

How can I paramaterise a T4 template to produce the same structure for different types?

I am building a T4 template that will build a POCO from a LINQ to SQL entity, but right now it produces one POCO file based on one L2S entity. How can I reuse this remplate to iterate through all L2S entities and produce a POCO for each one, or for any chosen one? ...

Can't reference an assembly in a T4 template.

I have the following code in a tester class in my main assembly, PocoGenerator. This assembly is supposed to use a T4 template to generate POCO's based on L2S entities in a referenced assembly (a project reference), DataObjects. var assemblyName = "DataObjects"; var dataObjects = AppDomain.CurrentDomain.Load(new AssemblyName(assemblyNa...