How to generate multiple output files from a single T4 Template
Date: Thursday, January 17, 2013 9:12 AM
Posted by: Nico Ploner
Category: T4
Usually it is sufficient when transforming a T4 Template “example.tt” results in a single output file “example.cs”. But there are situation in which one would like to have multiple different output files like:
- Putting each generated data class into a single code file
- Creating a server and a client component based on a common model
- Distribute generated code to multiple projects within a solution
- …
This blob post demonstrates how to use the tangible T4 Editor and free template from its sample gallery to create multiple output files. The first part shows how to make a T4 Template generate two different output files with different content. The second part shows how to create multiple output files in different projects within your solution. Finally a summary of all necessary steps is given.
Important Update V2.1.1
Date: Wednesday, October 3, 2012 2:08 PM
Posted by: Tim Fischer
Category: T4
Today we released an important update which addresses Visual Studio Crashes we heard from some users that used V2.1 and had the current word highlighter feature enabled. It also fixed other smaller bugs and brings enhancements in performance. We ask all users to update to 2.1.1 to get the best possible T4 Editor experience. As a convenience we also learnt from your feedback about our installer and improved the updating process a lot.
tangible T4 Editor V2.1 for VS2010 & VS 2012 RTM available
Date: Wednesday, September 5, 2012 5:21 PM
Posted by: Tim Fischer
Category: T4
We are glad to announce the availability of tangible T4 Editor 2.1 plus modeling tools for both VS2010 and VS2012 RTM. As usual you will find the updates on the visual studio gallery (VS2010 & VS2012).
Since Version 2.0 we added many useful features and worked on performance as well as support for VS2012 RTM. Lets look at the new features in more detail:
What is new?
Free Edition users will benefit from the following enhancements in Version 2.1:
- Support for VS 2012 RTM – tangible T4 Editor is the first available T4 Editor for a new Version of Visual Studio
- Full LINQ Query support in Statement Completion
- ASP.NET MVC Host support in IntelliSense
- Parameter Directive support in IntelliSense - template parameters are now available on this.
- Smart Indenting now assists you when writing templates
- Enhanced Brace-Matching – better visibility & also enabled for output code
- Current Word Highlighting is now available in T4 Editor.
- Option to show Line-Numbers
- More fine grained control of behavior via better Options Dialog & tangible T4 Menu
- Extensible Diagrams via Stereotypes – you can define custom properties e.g. IsRequired
- Custom Directive Processor support – if you use custom processor directive e.g. for a Microsoft UML Diagrams, Our Diagrams or from T4 Toolbox or you write your known you will notice that our IntelliSense now picks up Imports, Assembly-Reference and custom members provided by your directive processor automatically.
Pro Edition users will also enjoy these improvements:
- Improved Quick-Debugger now supports templates that use Visual Studio Automation (EnvDTE)
- Support for debugging parameter templates – parameters can be set in the properties window
- Add Code Generation Item Command - adds a T4 template for a defined input document and retransforms the template when the input document changes
- Format Output Document - applies a SmartFormat Command the generated output document
- Goto-Definition Command
- Code Generation for custom properties defined in Diagrams stereotypes via API from within a T4 Template. Access the value via the GetExtensiblePropertyValue Method on a ModelElement.
tangible T4 Editor V2.02 for VS2010 & VS 11 available
Date: Sunday, May 27, 2012 10:46 AM
Posted by: Tim Fischer
Category: T4
We just released a small update which addresses smaller issues users reported as well missing statement completions for this.Host.<something> this.WriteLine and other DLLs which should work in Free Edition.
tangible T4 Editor 2.0 plus modeling tools – Released!
Date: Friday, May 11, 2012 6:08 PM
Posted by: Tim Fischer
Category: T4
We just released the second generation of our tangible T4 Editor. Version 2.0 marks a big milestone for us. We have been working on this major release almost two years. This effort was done in parallel to the many Version 1.x updates and smaller feature improvements we shipped over the period of last 3 years T4 Editor Version 1.x exists.
What is new?
tangible T4 Editor 2.0 is almost a 100% rewrite of the existing Version 1.0 product. It addresses nearly all feedback we got from you regarding feature wishes and change requests. Thank you for providing feedback in the past – we really read every piece of feedback and take action on it.
Free Edition Users will notice these improvements and changes which result from your feedback:
- Support for VS2010 and VS11 (Beta) – Following the tradition from 1.x we will support two Visual Studio Versions in 2.x. tangible T4 2.x will be supported for VS2010 and VS11 (Beta). We have two separate installs.
- We use the real Visual Studio Code Editor: This now honors Tab Settings, Keybindings, UTF-8 Encoding, Version Control System Integration, Fonts and Colors, VS Search Dialog, Support for VS Editor Extensions like Incremental Search and Current Line Highlighting.
- Support for Dark Theme – Note you can customize the T4 Code Highlighting Color under Visual Studio Menu Tools->Options->Environment->Fonts & Colors ->”tangible T4 Background”. You can customize the other colors and fonts also via this Fonts & Colors dialog.
- New Statement-Completion within T4 Code Blocks behavior that corresponds to VS 2010 Editor behavior. Also completely new Parsers that now support newer C# and VB Language features. Also changed from generating Warnings about limitations of Free Edition to show up in Completion List instead in Error Window.
- Additional Directives to solve VS T4 Engine limitations: #includeForIntelliSenseOnly, #assemblyForIntelliSenseOnly, #newappdomain, #IntellisenseLanguage directives.
- Remaining Incompatibility with some ASP.NET MVC Builds should be fully resolved now.
- Additional Documentation and Training Videos which will get online in the next few days
It also adds major features to the PRO-Edition:
- Support for VS2010 and VS11 (Beta) and RTM (later)
- Debugging Support - two new features: Quick Debug with Preview and Debug in separate Visual Studio instance: Allows you to run your templates in a debugger and also see the generated output while the debugging is performed.
- New Statement-Completion within T4 Code Blocks behavior that corresponds to VS 2010 Editor behavior. Also completely new Parsers that now support newer C# and VB Language features.
- Transform on Build feature was improved and allows you to transform specific templates each time you hit the Build Project Button or F5.
- Navigation via Class/Member-Dropdown also to classes and members from included files.
Checkout the new Product Tour Video