t4

Can't access method in same assembly as my T4 template.

I've tried to resolve assembly reference pains in my T4 template by moving code out into a helper method in the same assembly and namespace as my template, but T4 refuses to find my helper method. The helper method: namespace PocoGenerator { public class EntityReflector { public static IEnumerable<PropertyInfo> GetPrope...

Pragmatic programmer code generation exercise

I am reading the The Pragmatic programmer and doing the following exercise in .net world (Chapter 3 - Code Generators) The Exercise "Write a code generator that takes the input in Listing 1, and generates output in two languages of your choice. Try to make it easy to add new languages." Listing 1 # Add a product # to the 'on-order' ...

T4 to generate DTO' and Nullable Datatypes

I'm trying to generate DTO's with T4. I found a great blog post that does exactly what i'm looking for but it explodes on Nullable data types. http://weblogs.asp.net/cibrax/archive/2009/03/11/code-generation-with-t4-an-entities-to-dto-example.aspx?CommentPosted=true#commentmessage This generates code with Nullable types like below ...

T4 tool for XCode

Hello folk, Does anything like the T4 text template generation tool of visual studio exist for XCode? Thanks for help, Enyra ...

T4 Preprocessed Template Debugging Not Working - Visual Studio 2010 RTM

I am attempting to debug a preprocessed T4 template and I am not able to step into the class created by running the preprocessed template. I am able to create an instance of the class but as soon as I try to step into while debugging, a new window pops up that says No source available. There is no source code available for the curren...

Access T4 template programmatically

I've written a simple T4 template (call it "web.tt) to generate a web.config file. Here's the gist of it: <#@ template debug="true" language="C#" hostSpecific="true" #> <#@ output extension=".config" #> <?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- yadda yadda yadda --> </configuration> Can I access this template pr...

Visual studio 2010 database project and code generation

Hi, I'm trying to use the database project in VS2010, but my setup is a bit different from standard and I can't find an easy way to get it to work. I have a "model" project which contains some xml model definitions of a simple information for an ETL process. As well as the schema for the supplied information, it contains other metadat...

Get referenced project's path in T4 template?

I have a solution that has a few projects in it. I'd like to create some T4 templates in one of my test projects to generate tests based on code in another project. The test project has a Project Reference to the other project. The problem I have is that I don't know how to get a file path to the edmx file I need to generate code from. ...

Testing EF 4.0 with POCO and t4 templates - How mock context?

I'm trying to create fake context accodring to http://blogs.msdn.com/b/adonet/archive/2009/12/17/walkthrough-test-driven-development-with-the-entity-framework-4-0.aspx As i can see there is an interface which exposes methods which returns IObjectSet<...>, but T4 templates generates methods which returns ObjectSet<...> and there is no ge...

Wix & T4 : no "Custom Tool" option

I want to generate a fragment using T4 but after adding a .tt file to the Wix project there is no "Custom Tool" option for this file. And there is no menu item "Run custom tool" when right clicking on the .tt file. Is there a hack for this ? I'm using VS 2010 and latest Wix 3.5 ...

NHaml T4 templates for CRUD?

Hello, I want to ask if anyone have or seen T4 templates for NHaml that are same as default T4 CRUD (List, Create etc) templates from MVC 2.0? Thanks for any source :) ...

Aspect Oriented Logging with Unity\T4\anything else

Hello, In my application we have a trace logger. We have log statements added at the beginning and end of most of the important methods tracing the method name and the parameter values. Now these trace statements are bloating the code and it is a bit of a pain to read through them. I am considering how can I separate this aspect of the...

Running T4 templates from other T4 template

Hi there, does anyone know if it's possible to run T4 template file from another T4 template, inside VS2010 Thank ...

T4 templates in VS 2010 Cannot Find Metada file SubSonic.Core.dll

I am using Subsonic 3 to generate DAL. Further I am using T4 templates to generate my BOs from DAL. Subsonic's T4 templates are working properly, but when I run my templates it gives me following error: Compiling transformation: Metadata file 'SubSonic.Core.dll' could not be found I have imported SubSonic in my settings.include file l...

Change the T4 POCO Entity Framework Template to inherit from my base class.

I'm trying to create a solution with layered architecture and self tracking entities. I used the Entity Framework C# POCO Entity Generator i download from Extensions Online Gallery. I separated the context.tt with the entities.tt on they're own class libraries. Mapped the entities.tt to the Model. Now i need to make these classes inherit...

Adding [DataMember] [DataContract] attributes in Entity Framework POCO Template

I would like some help adding in a POCO .tt Entity Framework template Attributes to support WCF serialization and if its possible how to add namespace usings to each entity. Thank you. ...

Visual Web Developer Express 2010 T4 Templates no icon?

I have installed Visual Web Developer Express 2010 but my .tt templates don't have icons. Do you know how to solve this issue? ...

T4 code generation template not behaving

I have a template fragment that looks like this: <#+ if (length == "0") #> return record.Substring(offset); <#+ else #> return record.Substring(offset, <#= length #>); When length != "0" it works fine, but when it is "0" it emits the record.Substring(offset); code ok but is then followed by the text "0);" (without the double-quote...

Can serialize, but cannot deserialize?

I've created POCO classes with T4 Templates for EF 4.0 and generated mock for Context. Everything was great, but i don't like to initialize even small Mock-DB in C# code, so i've created some functions which generates Mock-DB from real DB and i wanted to serialize this object and use it later in some Unit Tests... XML serialization fail...

T4MVC in MonoDevelop 2.4

Hello! Has anyone tried to make T4MVC work in MonoDevelop? Out of the box, I get this error: Could not resolve include file 'T4MVC.settings.t4'. When I include the full path in the include statement, it makes MonoDevelop crash completely. Thanks for any info! Marc Lacoursiere ...