Skip to content

tahir-hassan/T4Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T4Example

  • The Person.cs file can be thought of as the input.
  • The EqualityClassTemplate.tt acts as a template. You have to import it in a separate .tt file to generate a class.
  • The EqualityPerson.tt is a template which calls EqualityClassTemplate.tt, passing in arguments, and produces EqualityPerson.cs as its output.

Setting up EqualityClassTemplate.tt

Make sure to blank out the "Custom Tool" property of the file.

To change this property, click on the file in the Solution Explorer and go to the properties window.

hostspecific being set to true

In order to have this.Host reference in the .tt file (it is being used in EqualityClassTemplate.tt), you have to set hostspecific to true at the top of the .tt file:

<#@ template debug="false" hostspecific="true" language="C#" #>

Getting Intellisense

Since I am using Tangible's T4 Editor, it does not provide full code completion (you have to pay for it).

An easy workaround is to create a new C# console project and add the EnvDTE assembly. Then you can use code like so to check the what properties exist on the interfaces:

var dte = null as EnvDTE.DTE;

Useful Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages